<!DOCTYPE html>
<html lang="{{ language:language_alias }}">
    <head>
        <meta charset="utf-8">
        <title><?php 
echo $template['title'];
?>
</title>
        <?php 
echo $template['metadata'];
?>
        <link rel="icon" href="{{ site_favicon }}">
        <!-- Le styles -->
        <?php 
echo $template['css'];
$asset = new Cms_asset();
if ($__is_bootstrap_cdn_connected) {
    $asset->add_css('//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css');
} else {
    $asset->add_cms_css('bootstrap/css/bootstrap.min.css');
}
$asset->add_themes_css('bootstrap.min.css', '{{ used_theme }}', 'default');
$asset->add_themes_css('style.css', '{{ used_theme }}', 'default');
echo $asset->compile_css();
?>
        <!-- Le fav and touch icons -->
        <link rel="shortcut icon" href="{{ site_favicon }}">
        <style type="text/css">{{ widget_name:section_custom_style }}</style>
    </head>
    <body>
        <?php 
Exemple #2
0
    $selected = '';
}
// option for languages
$option_language = '';
foreach ($language_list as $language) {
    $selected = $language->code == $current_language ? 'selected' : '';
    $option_language .= '<option ' . $selected . ' value="' . $language->code . '">' . ucwords(str_replace('_', ' ', $language->name)) . '</option>';
}
// option for layouts
$option_layout = '<option selected value="' . $config_list['site_layout'] . '">' . ucwords(str_replace('_', ' ', $config_list['site_layout'])) . '</option>';
foreach ($layout_list as $layout) {
    if ($layout != $config_list['site_layout']) {
        $option_layout .= '<option value="' . $layout . '">' . ucwords(str_replace('_', ' ', $layout)) . '</option>';
    }
}
$asset = new Cms_asset();
$asset->add_cms_css('grocery_crud/css/jquery_plugins/chosen/chosen.css');
echo $asset->compile_css();
?>
<style type="text/css">
    .text-area-section{
        reblur: none;
        word-wrap: no-wrap;
        white-space: pre-wrap;
        overflow-x: auto;
        width:95%;
        min-width: 385px!important;
        min-height: 75px!important;
        margin-top: 10px!important;
        font-family: Courier;
        font-blur: small;
Exemple #3
0
<style type="text/css">
	.hidden {
		display: none!important;
		visibility: hidden;
	}
</style>
<?php
	$asset = new Cms_asset();
	foreach($css_files as $file){
		$asset->add_css($file);
	}
	echo $asset->compile_css();

	foreach($js_files as $file){
		$asset->add_js($file);
	}
	// also add adjust.js which contain of field adjustment function
	$asset->add_module_js('scripts/adjust.js', $module_path);
	echo $asset->compile_js();
	echo '<h4>Project</h4>';
    echo '<div style="padding-bottom: 10px;">';
    if($state != 'list'){
        echo '<p class="alert-warning alert">
                Import database only works for MySQL.
            </p>';
	    echo anchor(site_url('{{ module_path }}/data/nds/project/'),'All Projects','class="btn btn-primary"');
    }
    echo '</div>';
	echo $output;
?>
 /**
  * @author  goFrendiAsgard
  * @param   string view_url
  * @param   string data
  * @param   string navigation_name
  * @param   array config
  * @param   bool return_as_string
  * @return  string or null
  * @desc    replace $this->load->view. This method will also load header, menu etc except there is _only_content parameter via GET or POST
  */
 protected function view($view_url, $data = NULL, $navigation_name = NULL, $config = NULL, $return_as_string = FALSE)
 {
     $this->load->library('template');
     $result = NULL;
     $view_url = $this->cms_parse_keyword($view_url);
     /**
      * PREPARE PARAMETERS *********************************************************************************************
      */
     // get dynamic widget status
     // (this is necessary since sometime the function called directly without run the constructor, i.e: when using Modules::run)
     if (isset($_REQUEST['__cms_dynamic_widget'])) {
         $this->__cms_dynamic_widget = TRUE;
     }
     /**
      * PREPARE PARAMETERS *********************************************************************************************
      */
     // this method can be called as $this->view('view_path', $data, true);
     // or $this->view('view_path', $data, $navigation_name, true);
     if (is_bool($navigation_name) && count($config) == 0) {
         $return_as_string = $navigation_name;
         $navigation_name = NULL;
         $config = NULL;
     } else {
         if (is_bool($config)) {
             $return_as_string = $config;
             $config = NULL;
         }
     }
     if (!isset($return_as_string)) {
         $return_as_string = FALSE;
     }
     if (!isset($config)) {
         $config = array();
     }
     $privilege_required = isset($config['privileges']) ? $config['privileges'] : array();
     $custom_theme = isset($config['theme']) ? $config['theme'] : NULL;
     $custom_layout = isset($config['layout']) ? $config['layout'] : NULL;
     $custom_title = isset($config['title']) ? $config['title'] : NULL;
     $custom_metadata = isset($config['metadata']) ? $config['metadata'] : array();
     $custom_partial = isset($config['partials']) ? $config['partials'] : NULL;
     $custom_keyword = isset($config['keyword']) ? $config['keyword'] : NULL;
     $custom_description = isset($config['description']) ? $config['description'] : NULL;
     $custom_author = isset($config['author']) ? $config['author'] : NULL;
     $only_content = isset($config['only_content']) ? $config['only_content'] : FALSE;
     $always_allow = isset($config['always_allow']) ? $config['always_allow'] : FALSE;
     $layout_suffix = isset($config['layout_suffix']) ? $config['layout_suffix'] : '';
     $custom_css = isset($config['css']) ? $config['css'] : '';
     $custom_js = isset($config['js']) ? $config['js'] : '';
     /**
      * GUESS $navigation_name THROUGH ITS URL  ***********************************************************************
      */
     $navigation_name_provided = TRUE;
     if (!isset($navigation_name) && !$this->__cms_dynamic_widget) {
         $navigation_name = $this->cms_navigation_name();
         if (!$navigation_name) {
             $navigation_name_provided = FALSE;
         }
     }
     /**
      * CHECK IF THE CURRENT NAVIGATION IS ACCESSIBLE  *****************************************************************
      */
     if (!$always_allow) {
         $this->cms_guard_page($navigation_name, $privilege_required);
     }
     // privilege is absolute
     $this->cms_guard_page(NULL, $privilege_required);
     /**
      * CHECK IF THE PAGE IS STATIC  **********************************************************************************
      */
     $data = (array) $data;
     $row_navigation = NULL;
     if ($navigation_name != NULL) {
         $query = $this->db->select('navigation_id, title, page_title, page_keyword, description, default_theme, default_layout, only_content, is_static, static_content')->from(cms_table_name('main_navigation'))->where(array('navigation_name' => $navigation_name))->get();
         if ($query->num_rows() > 0) {
             $row_navigation = $query->row();
         }
     }
     if ($navigation_name_provided && !isset($data['_content']) && $row_navigation != NULL) {
         if ($row_navigation->is_static == 1) {
             $static_content = $row_navigation->static_content;
             // static_content should contains string
             if (!$static_content) {
                 $static_content = '';
             }
             if ($this->cms_editing_mode() && $this->cms_allow_navigate('main_navigation_management')) {
                 $static_content = '<div class="row" style="padding-top:10px; padding-bottom:10px;"><a class="btn btn-primary pull-right" href="{{ SITE_URL }}main/navigation/edit/' . $row_navigation->navigation_id . '">' . '<i class="glyphicon glyphicon-pencil"></i> Edit Page' . '</a></div>' . $static_content;
             }
             $data['cms_content'] = $static_content;
             $view_url = 'CMS_View';
         }
     }
     /**
      * SHOW THE PAGE IF IT IS ACCESSIBLE  *****************************************************************************
      */
     // GET THE THEME, TITLE & ONLY_CONTENT FROM DATABASE
     $theme = '';
     $title = '';
     $keyword = '';
     $default_theme = NULL;
     $default_layout = NULL;
     $page_title = NULL;
     $page_keyword = NULL;
     $page_description = NULL;
     $page_author = NULL;
     if ($navigation_name_provided && $row_navigation != NULL) {
         $default_theme = $row_navigation->default_theme;
         $default_layout = $row_navigation->default_layout;
         // title
         if (isset($row_navigation->page_title) && $row_navigation->page_title !== NULL && $row_navigation->page_title != '') {
             $page_title = $row_navigation->page_title;
         } else {
             if (isset($row_navigation->title) && $row_navigation->title !== NULL && $row_navigation->title != '') {
                 $page_title = $row_navigation->title;
             }
         }
         $page_title = isset($page_title) && $page_title !== NULL ? $page_title : '';
         // keyword
         $page_keyword = isset($row_navigation->page_keyword) && $row_navigation->page_keyword !== NULL ? $row_navigation->page_keyword : '';
         // keyword
         $page_description = isset($row_navigation->description) && $row_navigation->description !== NULL ? $row_navigation->description : '';
         // only content
         if (!isset($only_content)) {
             $only_content = $row_navigation->only_content == 1;
         }
     }
     // ASSIGN THEME
     if (isset($custom_theme) && $custom_theme !== NULL && $custom_theme != '') {
         $theme = $custom_theme;
     } else {
         if (isset($default_theme) && $default_theme != NULL && $default_theme != '') {
             $themes = $this->cms_get_theme_list();
             $theme_path = array();
             foreach ($themes as $theme) {
                 $theme_path[] = $theme['path'];
             }
             if (in_array($default_theme, $theme_path)) {
                 $theme = $default_theme;
             }
         } else {
             $theme = $this->cms_get_config('site_theme');
         }
     }
     // ASSIGN TITLE
     $title = '';
     if (isset($custom_title) && $custom_title !== NULL && $custom_title != '') {
         $title = $this->cms_get_config('site_name') . ' - ' . $custom_title;
     } else {
         if (isset($page_title) && $page_title !== NULL && $page_title != '') {
             $title = $this->cms_get_config('site_name') . ' - ' . $page_title;
         } else {
             $title = $this->cms_get_config('site_name');
         }
     }
     // ASSIGN KEYWORD
     if (isset($custom_keyword) && $custom_keyword != NULL && $custom_keyword != '') {
         $keyword = $custom_keyword;
     } else {
         if (isset($page_keyword) && $page_keyword !== NULL && $page_keyword != '') {
             $keyword = $page_keyword;
             if ($custom_keyword != '') {
                 $keyword .= ', ' . $custom_keyword;
             }
         } else {
             $keyword = '';
         }
     }
     // ASSIGN DESCRIPTION
     if (isset($custom_description) && $custom_description != NULL && $custom_description != '') {
         $description = $custom_description;
     } else {
         if (isset($page_description) && $page_description !== NULL && $page_description != '') {
             $description = $page_description;
             if ($custom_description != '') {
                 $description .= ', ' . $custom_description;
             }
         } else {
             $description = '';
         }
     }
     // ASSIGN AUTHOR
     if (isset($custom_author) && $custom_author != NULL && $custom_author != '') {
         $author = $custom_author;
     } else {
         $author = $this->{$this->__cms_base_model_name}->cms_get_super_admin()->real_name;
     }
     // GET THE LAYOUT
     if (isset($custom_layout)) {
         $layout = $custom_layout;
     } else {
         if (isset($default_layout) && $default_layout != '') {
             $layout = $default_layout;
         } else {
             $this->load->library('user_agent');
             $layout = $this->agent->is_mobile() ? 'mobile' : $this->cms_get_config('site_layout');
         }
     }
     // ADJUST THEME AND LAYOUT
     if (!$this->cms_layout_exists($theme, $layout)) {
         // ASSIGN LAYOUT
         if (!file_exists(FCPATH . 'themes/' . $theme) || !is_dir(FCPATH . 'themes/' . $theme)) {
             $theme = 'neutral';
         }
         if (!file_exists(FCPATH . 'themes/' . $theme . '/views/layouts/' . $layout . '.php')) {
             $layout = 'default';
             if (!file_exists(FCPATH . 'themes/' . $theme . '/views/layouts/default.php')) {
                 $theme = 'neutral';
             }
         }
     }
     // save used_theme
     $this->session->set_userdata('__cms_used_theme', $theme);
     // ADD AUTHENTICATED SUFFIX (in case of user has logged in)
     $cms_user_id = $this->cms_user_id();
     if ($layout_suffix == '' && isset($cms_user_id) && $cms_user_id) {
         $layout_suffix = 'authenticated';
     }
     if ($this->cms_layout_exists($theme, $layout . '_' . $layout_suffix)) {
         $layout = $layout . '_' . $layout_suffix;
     }
     $data['__is_bootstrap_cdn_connected'] = FALSE;
     // IT'S SHOW TIME
     if ($only_content || $this->__cms_dynamic_widget || isset($_REQUEST['_only_content']) || $this->input->is_ajax_request()) {
         $result = $this->load->view($view_url, $data, TRUE);
         $result = $custom_css . $custom_js . $result;
     } else {
         // save navigation name
         $this->cms_ci_session('__cms_navigation_name', $navigation_name);
         // set theme, layout and title
         $this->template->title($title);
         $this->template->set_theme($theme);
         $this->template->set_layout($layout);
         // set keyword metadata
         if ($keyword != '') {
             $keyword_metadata = '<meta name="keyword" content="' . $keyword . '">';
             $this->template->append_metadata($keyword_metadata);
         }
         // set description metadata
         if ($description != '') {
             $description_metadata = '<meta name="description" content="' . $description . '">';
             $this->template->append_metadata($description_metadata);
         }
         // set author metadata
         if ($author != '') {
             $author_metadata = '<meta name="author" content="' . $author . '">';
             $this->template->append_metadata($author_metadata);
         }
         // add IE compatibility
         $this->template->append_metadata('<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">');
         // add width
         $this->template->append_metadata('<meta name="viewport" content="width=device-width, initial-scale=1.0">');
         $asset = new Cms_asset();
         $asset->add_js(base_url('assets/grocery_crud/js/jquery-1.10.2.min.js'));
         // ckeditor adjustment thing
         $asset->add_internal_js($this->cms_ck_adjust_script());
         // add javascript base_url for ckeditor
         $asset->add_internal_js('var __cms_base_url = "' . base_url() . '";');
         // check login status
         //$login_code = '<script type="text/javascript">';
         $login_code = '';
         if ($this->cms_user_id() > 0) {
             $login_code .= 'var __cms_is_login = true;';
         } else {
             $login_code .= 'var __cms_is_login = false;';
         }
         $login_code .= 'setInterval(function(){
             $.ajax({
                 url : "{{ site_url }}main/json_login_info",
                 dataType: "json",
                 success: function(response){
                     if(response.is_login != __cms_is_login){
                         window.location = $(location).attr("href");
                     }
                 }
             });
         },300000);';
         $asset->add_internal_js($login_code);
         // google analytic
         $analytic_property_id = $this->cms_get_config('cms_google_analytic_property_id');
         if (trim($analytic_property_id) != '') {
             if ($this->cms_is_connect('google-analytics.com')) {
                 // create analytic code
                 $analytic_code = '';
                 $analytic_code .= 'var _gaq = _gaq || []; ';
                 $analytic_code .= '_gaq.push([\'_setAccount\', \'' . $analytic_property_id . '\']); ';
                 $analytic_code .= '_gaq.push([\'_trackPageview\']); ';
                 $analytic_code .= '(function() { ';
                 $analytic_code .= 'var ga = document.createElement(\'script\'); ga.type = \'text/javascript\'; ga.async = true; ';
                 $analytic_code .= 'ga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' : \'http://www\') + \'.google-analytics.com/ga.js\'; ';
                 $analytic_code .= 'var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(ga, s); ';
                 $analytic_code .= '})(); ';
                 $asset->add_internal_js($analytic_code);
             }
         }
         // add hack if exists
         if (!isset($_SESSION)) {
             session_start();
         }
         if (isset($_SESSION['__cms_flash_metadata'])) {
             $this->template->append_metadata($_SESSION['__cms_flash_metadata']);
             unset($_SESSION['__cms_flash_metadata']);
         }
         // config metadata
         foreach ($custom_metadata as $metadata) {
             $this->template->append_metadata($metadata);
         }
         // append custom css & js
         $this->template->append_js($asset->compile_js());
         $this->template->append_css($asset->compile_css());
         $this->template->append_js($custom_js);
         $this->template->append_css($custom_css);
         $this->load->helper('directory');
         $partial_path = BASEPATH . '../themes/' . $theme . '/views/partials/' . $layout . '/';
         if (is_dir($partial_path)) {
             $partials = directory_map($partial_path, 1);
             foreach ($partials as $partial) {
                 // if is directory or is not php, then ignore it
                 if (is_dir($partial)) {
                     continue;
                 }
                 $partial_extension = pathinfo($partial_path . $partial, PATHINFO_EXTENSION);
                 if (strtoupper($partial_extension) != 'PHP') {
                     continue;
                 }
                 // add partial to template
                 $partial_name = pathinfo($partial_path . $partial, PATHINFO_FILENAME);
                 if (isset($custom_partial[$partial_name])) {
                     $this->template->inject_partial($partial_name, $custom_partial[$partial_name]);
                 } else {
                     $this->template->set_partial($partial_name, 'partials/' . $layout . '/' . $partial, $data);
                 }
             }
         }
         $result = $this->template->build($view_url, $data, TRUE);
     }
     // parse keyword
     $result = $this->cms_parse_keyword($result);
     // parse widgets used_theme & navigation_path
     $result = $this->__cms_parse_widget_theme_path($result, $theme, $layout, $navigation_name);
     $this->load->library('cms_asset');
     $asset = new Cms_asset();
     $result = $asset->minify($result);
     if ($return_as_string) {
         return $result;
     } else {
         $this->cms_show_html($result);
     }
 }
 protected function render_crud($crud = NULL)
 {
     if ($crud == NULL) {
         $crud = $this->CRUD;
     }
     $output = $crud->render();
     // prepare css and js, add them to config
     $config = array();
     $asset = new Cms_asset();
     foreach ($output->css_files as $file) {
         $asset->add_css($file);
     }
     $config['css'] = $asset->compile_css();
     foreach ($output->js_files as $file) {
         $asset->add_js($file);
     }
     $config['js'] = $asset->compile_js();
     $output->output = preg_replace_callback('/(<option[^<>]*>)(.*?)(<\\/option>)/si', array($this, '_ommit_nbsp'), $output->output);
     return array('output' => $output, 'config' => $config);
 }
Exemple #6
0
 public function index()
 {
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // initialize groceryCRUD
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     $crud = $this->new_crud();
     $crud->unset_jquery();
     // set model
     // $crud->set_model($this->cms_module_path().'/grocerycrud_category_model');
     // adjust groceryCRUD's language to No-CMS's language
     $crud->set_language($this->cms_language());
     // table name
     $crud->set_table($this->t('template'));
     // set subject
     $crud->set_subject('template');
     // displayed columns on list
     $crud->columns('name', 'icon', 'description');
     // displayed columns on edit operation
     $crud->edit_fields('name', 'icon', 'description', 'homepage', 'configuration', 'modules');
     // displayed columns on add operation
     $crud->add_fields('name', 'icon', 'description', 'homepage', 'configuration', 'modules');
     // required field
     $crud->required_fields('name');
     $crud->unique_fields('name');
     $crud->unset_read();
     // caption of each columns
     $crud->display_as('name', 'Name');
     $crud->display_as('icon', 'Icon');
     $crud->display_as('description', 'Description');
     $crud->display_as('homepage', 'Homepage (HTML)');
     $crud->display_as('configuration', 'Configuration (JSON)');
     $crud->display_as('modules', 'Modules (Comma Separated)');
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // HINT: Put set relation (lookup) codes here
     // (documentation: http://www.grocerycrud.com/documentation/options_functions/set_relation)
     // eg:
     // 		$crud->set_relation( $field_name , $related_table, $related_title_field , $where , $order_by );
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // HINT: Put set relation_n_n (detail many to many) codes here
     // (documentation: http://www.grocerycrud.com/documentation/options_functions/set_relation_n_n)
     // eg:
     // 		$crud->set_relation_n_n( $field_name, $relation_table, $selection_table, $primary_key_alias_to_this_table,
     // 			$primary_key_alias_to_selection_table , $title_field_selection_table, $priority_field_relation );
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // HINT: Put custom field type here
     // (documentation: http://www.grocerycrud.com/documentation/options_functions/field_type)
     // eg:
     // 		$crud->field_type( $field_name , $field_type, $value  );
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     $crud->unset_texteditor('description');
     $crud->unset_texteditor('homepage');
     $crud->unset_texteditor('configuration');
     $crud->unset_texteditor('modules');
     $crud->set_field_upload('icon', 'modules/' . $this->cms_module_path() . '/assets/uploads');
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // HINT: Put callback here
     // (documentation: httm://www.grocerycrud.com/documentation/options_functions)
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     $crud->callback_before_insert(array($this, 'before_insert'));
     $crud->callback_before_update(array($this, 'before_update'));
     $crud->callback_before_delete(array($this, 'before_delete'));
     $crud->callback_after_insert(array($this, 'after_insert'));
     $crud->callback_after_update(array($this, 'after_update'));
     $crud->callback_after_delete(array($this, 'after_delete'));
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // render
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     $output = $crud->render();
     // prepare css & js, add them to config
     $config = array();
     $asset = new Cms_asset();
     foreach ($output->css_files as $file) {
         $asset->add_css($file);
     }
     $config['css'] = $asset->compile_css();
     foreach ($output->js_files as $file) {
         $asset->add_js($file);
     }
     $config['js'] = $asset->compile_js();
     // show the view
     $this->view($this->cms_module_path() . '/manage_template_view', $output, $this->n('manage_template'), $config);
 }
 public function index()
 {
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // initialize groceryCRUD
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     $crud = $this->new_crud();
     // this is just for code completion
     if (FALSE) {
         $crud = new Extended_Grocery_CRUD();
     }
     // check state & get primary_key
     $state = $crud->getState();
     $state = $crud->getState();
     $state_info = $crud->getStateInfo();
     $primary_key = isset($state_info->primary_key) ? $state_info->primary_key : NULL;
     switch ($state) {
         case 'unknown':
             break;
         case 'list':
             break;
         case 'add':
             break;
         case 'edit':
             break;
         case 'delete':
             break;
         case 'insert':
             break;
         case 'update':
             break;
         case 'ajax_list':
             break;
         case 'ajax_list_info':
             break;
         case 'insert_validation':
             break;
         case 'update_validation':
             break;
         case 'upload_file':
             break;
         case 'delete_file':
             break;
         case 'ajax_relation':
             break;
         case 'ajax_relation_n_n':
             break;
         case 'success':
             break;
         case 'export':
             break;
         case 'print':
             break;
     }
     // unset things
     $crud->unset_jquery();
     $crud->unset_read();
     // $crud->unset_add();
     // $crud->unset_edit();
     // $crud->unset_list();
     // $crud->unset_back_to_list();
     // $crud->unset_print();
     // $crud->unset_export();
     // set model
     // $crud->set_model($this->cms_module_path().'/grocerycrud_main_language_model');
     // adjust groceryCRUD's language to No-CMS's language
     $crud->set_language($this->cms_language());
     // table name
     $crud->set_table(cms_table_name('main_language'));
     // set subject
     $crud->set_subject('Language');
     // displayed columns on list
     $crud->columns('name', 'code', 'iso_code', 'translations');
     // displayed columns on edit operation
     $crud->edit_fields('name', 'code', 'iso_code', 'translations');
     // displayed columns on add operation
     $crud->add_fields('name', 'code', 'iso_code', 'translations');
     // caption of each columns
     $crud->display_as('name', 'Name');
     $crud->display_as('iso_code', 'ISO Code');
     $crud->display_as('translations', 'Translations');
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // HINT: Put required field validation codes here
     // (documentation: http://www.grocerycrud.com/documentation/options_functions/required_fields)
     // eg:
     //      $crud->required_fields( $field1, $field2, $field3, ... );
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     $crud->required_fields('name', 'code');
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // HINT: Put required field validation codes here
     // (documentation: http://www.grocerycrud.com/documentation/options_functions/unique_fields)
     // eg:
     //      $crud->unique_fields( $field1, $field2, $field3, ... );
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     $crud->unique_fields('name', 'code', 'iso_code');
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // HINT: Put field validation codes here
     // (documentation: http://www.grocerycrud.com/documentation/options_functions/set_rules)
     // eg:
     //      $crud->set_rules( $field_name , $caption, $filter );
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // HINT: Put set relation (lookup) codes here
     // (documentation: http://www.grocerycrud.com/documentation/options_functions/set_relation)
     // eg:
     //      $crud->set_relation( $field_name , $related_table, $related_title_field , $where , $order_by );
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // HINT: Put set relation_n_n (detail many to many) codes here
     // (documentation: http://www.grocerycrud.com/documentation/options_functions/set_relation_n_n)
     // eg:
     //      $crud->set_relation_n_n( $field_name, $relation_table, $selection_table, $primary_key_alias_to_this_table,
     //          $primary_key_alias_to_selection_table , $title_field_selection_table, $priority_field_relation );
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // HINT: Put custom field type here
     // (documentation: http://www.grocerycrud.com/documentation/options_functions/field_type)
     // eg:
     //      $crud->field_type( $field_name , $field_type, $value  );
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     $crud->unset_texteditor('code');
     $crud->unset_texteditor('iso_code');
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // HINT: Put callback here
     // (documentation: httm://www.grocerycrud.com/documentation/options_functions)
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     $crud->callback_before_insert(array($this, '_before_insert'));
     $crud->callback_before_update(array($this, '_before_update'));
     $crud->callback_before_delete(array($this, '_before_delete'));
     $crud->callback_after_insert(array($this, '_after_insert'));
     $crud->callback_after_update(array($this, '_after_update'));
     $crud->callback_after_delete(array($this, '_after_delete'));
     $crud->callback_column('translations', array($this, '_callback_column_translations'));
     $crud->callback_field('translations', array($this, '_callback_field_translations'));
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // HINT: Put custom error message here
     // (documentation: httm://www.grocerycrud.com/documentation/set_lang_string)
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // $crud->set_lang_string('delete_error_message', 'Cannot delete the record');
     // $crud->set_lang_string('update_error',         'Cannot edit the record'  );
     // $crud->set_lang_string('insert_error',         'Cannot add the record'   );
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // render
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     $output = $crud->render();
     // prepare css & js, add them to config
     $config = array();
     $asset = new Cms_asset();
     foreach ($output->css_files as $file) {
         $asset->add_css($file);
     }
     $config['css'] = $asset->compile_css();
     foreach ($output->js_files as $file) {
         $asset->add_js($file);
     }
     $config['js'] = $asset->compile_js();
     // show the view
     $this->view($this->cms_module_path() . '/language/manage_main_language_view', $output, $this->n('main_language_management'), $config);
 }
Exemple #8
0
<?php

$asset = new Cms_asset();
foreach ($css_files as $file) {
    $asset->add_css($file);
}
echo $asset->compile_css();
foreach ($js_files as $file) {
    $asset->add_js($file);
}
echo $asset->compile_js();
echo '<h4>Template</h4>';
echo $output;
Exemple #9
0
 public function route()
 {
     $this->cms_guard_page('main_route_management');
     $crud = $this->new_crud();
     $crud->unset_jquery();
     $crud->set_table(cms_table_name('main_route'));
     $crud->set_subject('Route');
     $crud->required_fields('key', 'value');
     $crud->unique_fields('key');
     $crud->unset_read();
     $crud->columns('key', 'value', 'description');
     $crud->edit_fields('key', 'value', 'description');
     $crud->add_fields('key', 'value', 'description');
     $crud->display_as('key', 'Key')->display_as('value', 'Value')->display_as('description', 'Description');
     $crud->unset_texteditor('key');
     $crud->unset_texteditor('value');
     $crud->unset_texteditor('description');
     $crud->callback_after_insert(array($this, '_after_insert_route'));
     $crud->callback_after_delete(array($this, '_after_delete_route'));
     $crud->callback_after_update(array($this, '_after_update_route'));
     $crud->set_language($this->cms_language());
     $output = $crud->render();
     // prepare css & js, add them to config
     $config = array();
     $asset = new Cms_asset();
     foreach ($output->css_files as $file) {
         $asset->add_css($file);
     }
     $config['css'] = $asset->compile_css();
     foreach ($output->js_files as $file) {
         $asset->add_js($file);
     }
     $config['js'] = $asset->compile_js();
     // show the view
     $this->view('main/main_route', $output, 'main_route_management', $config);
 }
Exemple #10
0
 public function index()
 {
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // initialize groceryCRUD
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     $crud = $this->new_crud();
     $crud->unset_jquery();
     $group_name_list = $this->cms_user_group();
     $group_id_list = $this->cms_user_group_id();
     // check state
     $state = $crud->getState();
     $state_info = $crud->getStateInfo();
     $primary_key = isset($state_info->primary_key) ? $state_info->primary_key : NULL;
     $allow_continue = TRUE;
     if ($this->cms_user_id() != 1 && !in_array(1, $group_id_list) && !in_array('Blog Editor', $group_name_list) && isset($primary_key) && $primary_key !== NULL) {
         $query = $this->db->select('author_user_id')->from($this->cms_complete_table_name('article'))->where(array('article_id' => $primary_key, 'author_user_id' => $this->cms_user_id()))->get();
         if ($query->num_rows() == 0) {
             $allow_continue = FALSE;
         }
     }
     switch ($state) {
         case 'unknown':
             break;
         case 'list':
             break;
         case 'add':
             break;
         case 'edit':
             $this->redirect(!$allow_continue);
             break;
         case 'delete':
             $this->redirect(!$allow_continue);
             break;
         case 'insert':
             $this->redirect(!$allow_continue);
             break;
         case 'update':
             break;
         case 'ajax_list':
             break;
         case 'ajax_list_info':
             break;
         case 'insert_validation':
             break;
         case 'update_validation':
             break;
         case 'upload_file':
             break;
         case 'delete_file':
             break;
         case 'ajax_relation':
             break;
         case 'ajax_relation_n_n':
             break;
         case 'success':
             break;
         case 'export':
             break;
         case 'print':
             break;
     }
     // set model
     //$crud->set_model($this->cms_module_path().'/grocerycrud_article_model');
     // adjust groceryCRUD's language to No-CMS's language
     $crud->set_language($this->cms_language());
     // table name
     $crud->set_table($this->cms_complete_table_name('article'));
     // only super admin or blog editor able to edit other's article
     if ($this->cms_user_id() != 1 && !in_array(1, $group_id_list) && !in_array('Blog Editor', $group_name_list)) {
         $crud->where('author_user_id', $this->cms_user_id());
     }
     // set subject
     $crud->set_subject('Article');
     // displayed columns on list
     $crud->columns('article_title', 'author_user_id', 'status', 'publish_date', 'featured', 'allow_comment', 'categories', 'comments');
     // displayed columns on edit operation
     $crud->edit_fields('article_title', 'article_url', 'date', 'status', 'publish_date', 'author_user_id', 'content', 'keyword', 'description', 'featured', 'allow_comment', 'categories', 'photos', 'comments');
     // displayed columns on add operation
     $crud->add_fields('article_title', 'article_url', 'date', 'status', 'publish_date', 'author_user_id', 'content', 'keyword', 'description', 'featured', 'allow_comment', 'categories', 'photos', 'comments');
     $crud->required_fields('article_title', 'status');
     $crud->unique_fields('article_title', 'article_url');
     $crud->unset_read();
     // caption of each columns
     $crud->display_as('article_title', 'Article Title');
     $crud->display_as('article_url', 'Permalink (Left blank for default)');
     $crud->display_as('date', 'Created Date');
     $crud->display_as('author_user_id', 'Author');
     $crud->display_as('content', 'Content');
     $crud->display_as('keyword', 'Keyword metadata (comma separated)');
     $crud->display_as('description', 'Description metadata');
     $crud->display_as('featured', 'Featured');
     $crud->display_as('allow_comment', 'Allow Comment');
     $crud->display_as('categories', 'Categories');
     $crud->display_as('photos', 'Photos');
     $crud->display_as('comments', 'Comments');
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // HINT: Put set relation (lookup) codes here
     // (documentation: http://www.grocerycrud.com/documentation/options_functions/set_relation)
     // eg:
     //      $crud->set_relation( $field_name , $related_table, $related_title_field , $where , $order_by );
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     if ($state == 'list' || $state == 'ajax_list' || $state == 'export' || $state == 'print' || $state == 'success') {
         $crud->set_relation('author_user_id', cms_table_name('main_user'), 'user_name');
     }
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // HINT: Put set relation_n_n (detail many to many) codes here
     // (documentation: http://www.grocerycrud.com/documentation/options_functions/set_relation_n_n)
     // eg:
     //      $crud->set_relation_n_n( $field_name, $relation_table, $selection_table, $primary_key_alias_to_this_table,
     //          $primary_key_alias_to_selection_table , $title_field_selection_table, $priority_field_relation );
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     $crud->set_relation_n_n('categories', $this->cms_complete_table_name('category_article'), $this->cms_complete_table_name('category'), 'article_id', 'category_id', 'category_name', NULL);
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // HINT: Put custom field type here
     // (documentation: http://www.grocerycrud.com/documentation/options_functions/field_type)
     // eg:
     //      $crud->field_type( $field_name , $field_type, $value  );
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     if ($state != 'list' && $state != 'ajax_list' && $state != 'print' && $state != 'export') {
         $crud->field_type('author_user_id', 'hidden');
     }
     $crud->field_type('date', 'hidden');
     $crud->field_type('allow_comment', 'true_false');
     $crud->field_type('featured', 'true_false');
     $crud->unset_texteditor('article_title');
     $crud->unset_texteditor('article_url');
     $crud->unset_texteditor('keyword');
     $crud->unset_texteditor('description');
     if ($this->cms_user_id() != 1 && !in_array(1, $group_id_list) && !in_array('Blog Editor', $group_name_list) && !in_array('Blog Author', $group_name_list)) {
         $crud->field_type('status', 'hidden', 'draft');
         $crud->field_type('publish_date', 'hidden');
     } else {
         $crud->field_type('status', 'enum', array('draft', 'published', 'scheduled'));
         $crud->field_type('publish_date', 'datetime');
     }
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // HINT: Put callback here
     // (documentation: httm://www.grocerycrud.com/documentation/options_functions)
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     $crud->callback_before_insert(array($this, 'before_insert'));
     $crud->callback_before_update(array($this, 'before_update'));
     $crud->callback_before_delete(array($this, 'before_delete'));
     $crud->callback_after_insert(array($this, 'after_insert'));
     $crud->callback_after_update(array($this, 'after_update'));
     $crud->callback_after_delete(array($this, 'after_delete'));
     $crud->callback_column('photos', array($this, 'callback_column_photos'));
     $crud->callback_field('photos', array($this, 'callback_field_photos'));
     $crud->callback_column('comments', array($this, 'callback_column_comments'));
     $crud->callback_field('comments', array($this, 'callback_field_comments'));
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // render
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     $output = $crud->render();
     // prepare css & js, add them to config
     $config = array();
     $asset = new Cms_asset();
     foreach ($output->css_files as $file) {
         $asset->add_css($file);
     }
     $config['css'] = $asset->compile_css();
     foreach ($output->js_files as $file) {
         $asset->add_js($file);
     }
     $config['js'] = $asset->compile_js();
     // show the view
     $this->view($this->cms_module_path() . '/manage_article_view', $output, $this->cms_complete_navigation_name('manage_article'), $config);
 }
Exemple #11
0
 public function index()
 {
     $crud = $this->make_crud();
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // render
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     $output = $crud->render();
     // prepare css and js, add them to config
     $config = array();
     $asset = new Cms_asset();
     foreach ($output->css_files as $file) {
         $asset->add_css($file);
     }
     $config['css'] = $asset->compile_css();
     foreach ($output->js_files as $file) {
         $asset->add_js($file);
     }
     $config['js'] = $asset->compile_js();
     // show the view
     $this->view($this->cms_module_path() . '/Manage_tourism_view', $output, $this->cms_complete_navigation_name('manage_tourism'), $config);
 }
Exemple #12
0
 public function index()
 {
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // initialize groceryCRUD
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     $crud = $this->new_crud();
     $crud->unset_jquery();
     $group_name_list = $this->cms_user_group();
     $group_id_list = $this->cms_user_group_id();
     // check state
     $state = $crud->getState();
     $state_info = $crud->getStateInfo();
     $primary_key = isset($state_info->primary_key) ? $state_info->primary_key : NULL;
     $super_admin_user_id = array(1);
     if (CMS_SUBSITE != '') {
         // GET MAIN TABLE PREFIX
         $main_config_file = APPPATH . 'config/main/cms_config.php';
         if (file_exists($main_config_file)) {
             include $main_config_file;
             $main_table_prefix = $config['__cms_table_prefix'];
             $main_table_prefix = $main_table_prefix == '' ? '' : $main_table_prefix . '_';
             // GET MODULE TABLE PREFIX
             $query = $this->db->select('module_path')->from($main_table_prefix . 'main_module')->where('module_name', 'gofrendi.noCMS.module')->get();
             if ($query->num_rows() > 0) {
                 $row = $query->row;
                 $module_path = $row->module_path;
                 $module_config_file = FCPATH . 'modules/' . $module_path . '/config/module_config.php';
                 if (!file_exists($module_config_file)) {
                     // get module table prefix
                     include $module_config_file;
                     $module_table_prefix = $config['module_table_prefix'];
                     $module_table_prefix = $module_table_prefix == '' ? '' : $module_table_prefix . '_';
                     $subsite_table_ = $main_table_prefix . $module_table_prefix . 'subsite';
                     $query = $this->db->select('user_id')->from($subsite_table)->where('name', CMS_SUBSITE)->get();
                     if ($query->num_rows() > 0) {
                         $row = $query->row();
                         $super_admin_user_id[] = $row->user_id;
                     }
                 }
             }
         }
     }
     $allow_continue = TRUE;
     if (!in_array($this->cms_user_id(), $super_admin_user_id) && !in_array(1, $group_id_list) && !in_array('Blog Editor', $group_name_list) && isset($primary_key) && $primary_key !== NULL) {
         $query = $this->db->select('author_user_id')->from($this->t('article'))->where(array('article_id' => $primary_key, 'author_user_id' => $this->cms_user_id()))->get();
         if ($query->num_rows() == 0) {
             $allow_continue = FALSE;
         }
     }
     switch ($state) {
         case 'unknown':
             break;
         case 'list':
             break;
         case 'add':
             break;
         case 'edit':
             $this->redirect(!$allow_continue);
             break;
         case 'delete':
             $this->redirect(!$allow_continue);
             break;
         case 'insert':
             $this->redirect(!$allow_continue);
             break;
         case 'update':
             break;
         case 'ajax_list':
             break;
         case 'ajax_list_info':
             break;
         case 'insert_validation':
             break;
         case 'update_validation':
             break;
         case 'upload_file':
             break;
         case 'delete_file':
             break;
         case 'ajax_relation':
             break;
         case 'ajax_relation_n_n':
             break;
         case 'success':
             break;
         case 'export':
             break;
         case 'print':
             break;
     }
     // set model
     //$crud->set_model($this->cms_module_path().'/grocerycrud_article_model');
     // adjust groceryCRUD's language to No-CMS's language
     $crud->set_language($this->cms_language());
     // table name
     $crud->set_table($this->t('article'));
     // only super admin or blog editor able to edit other's article
     if (!in_array($this->cms_user_id(), $super_admin_user_id) && !in_array(1, $group_id_list) && !in_array('Blog Editor', $group_name_list)) {
         $crud->where('author_user_id', $this->cms_user_id());
     }
     // set subject
     $crud->set_subject('Article');
     // displayed columns on list
     $crud->columns('article_title', 'author_user_id', 'status', 'publish_date', 'featured', 'allow_comment', 'categories', 'comments');
     // displayed columns on edit operation
     $crud->edit_fields('article_title', 'article_url', 'date', 'status', 'publish_date', 'author_user_id', 'content', 'categories', 'keyword', 'description', 'featured', 'allow_comment', 'photos', 'comments');
     // displayed columns on add operation
     $crud->add_fields('article_title', 'article_url', 'date', 'status', 'publish_date', 'author_user_id', 'content', 'categories', 'keyword', 'description', 'featured', 'allow_comment', 'photos', 'comments');
     $crud->required_fields('article_title', 'status');
     $crud->unique_fields('article_title', 'article_url');
     $crud->unset_read();
     // caption of each columns
     $crud->display_as('article_title', 'Article Title');
     $crud->display_as('status', 'Publication Status');
     $crud->display_as('article_url', 'Permalink (Left blank for default)');
     $crud->display_as('date', 'Created Date');
     $crud->display_as('author_user_id', 'Author');
     $crud->display_as('content', 'Content');
     $crud->display_as('keyword', 'Keyword metadata (comma separated)');
     $crud->display_as('description', 'Description metadata');
     $crud->display_as('featured', 'Featured');
     $crud->display_as('allow_comment', 'Allow Comment');
     $crud->display_as('categories', 'Categories');
     $crud->display_as('photos', 'Photos');
     $crud->display_as('comments', 'Comments');
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // HINT: Put set relation (lookup) codes here
     // (documentation: http://www.grocerycrud.com/documentation/options_functions/set_relation)
     // eg:
     //      $crud->set_relation( $field_name , $related_table, $related_title_field , $where , $order_by );
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     if ($state == 'list' || $state == 'ajax_list' || $state == 'export' || $state == 'print' || $state == 'success') {
         $crud->set_relation('author_user_id', $this->cms_user_table_name(), 'user_name');
     }
     if (in_array($this->cms_user_id(), $super_admin_user_id) || in_array(1, $group_id_list) || in_array('Blog Editor', $group_name_list) || in_array('Blog Author', $group_name_list)) {
         $crud->set_relation('status', $this->t('publication_status'), 'status');
     }
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // HINT: Put set relation_n_n (detail many to many) codes here
     // (documentation: http://www.grocerycrud.com/documentation/options_functions/set_relation_n_n)
     // eg:
     //      $crud->set_relation_n_n( $field_name, $relation_table, $selection_table, $primary_key_alias_to_this_table,
     //          $primary_key_alias_to_selection_table , $title_field_selection_table, $priority_field_relation );
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     $crud->set_relation_n_n('categories', $this->t('category_article'), $this->t('category'), 'article_id', 'category_id', 'category_name', NULL);
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // HINT: Put custom field type here
     // (documentation: http://www.grocerycrud.com/documentation/options_functions/field_type)
     // eg:
     //      $crud->field_type( $field_name , $field_type, $value  );
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     if ($state != 'list' && $state != 'ajax_list' && $state != 'print' && $state != 'export') {
         $crud->field_type('author_user_id', 'hidden');
     }
     $crud->field_type('date', 'hidden');
     $crud->field_type('allow_comment', 'true_false');
     $crud->field_type('featured', 'true_false');
     $crud->unset_texteditor('article_title');
     $crud->unset_texteditor('article_url');
     $crud->unset_texteditor('keyword');
     $crud->unset_texteditor('description');
     $crud->set_outside_tab(6);
     $crud->set_tabs(array('Setting' => 4, 'Photos' => 1, 'Comments' => 1));
     $crud->set_tab_glyphicons(array('Setting' => 'glyphicon-th-list', 'Photos' => 'glyphicon-picture', 'Comments' => 'glyphicon-comment'));
     if (!in_array($this->cms_user_id(), $super_admin_user_id) && !in_array(1, $group_id_list) && !in_array('Blog Editor', $group_name_list) && !in_array('Blog Author', $group_name_list)) {
         $crud->field_type('status', 'hidden', 'draft');
         $crud->field_type('publish_date', 'hidden');
     } else {
         $crud->field_type('publish_date', 'datetime');
     }
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // HINT: Put callback here
     // (documentation: httm://www.grocerycrud.com/documentation/options_functions)
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     $crud->callback_before_insert(array($this, 'before_insert'));
     $crud->callback_before_update(array($this, 'before_update'));
     $crud->callback_before_delete(array($this, 'before_delete'));
     $crud->callback_after_insert(array($this, 'after_insert'));
     $crud->callback_after_update(array($this, 'after_update'));
     $crud->callback_after_delete(array($this, 'after_delete'));
     $crud->callback_column('photos', array($this, 'callback_column_photos'));
     $crud->callback_field('photos', array($this, 'callback_field_photos'));
     $crud->callback_column('comments', array($this, 'callback_column_comments'));
     $crud->callback_field('comments', array($this, 'callback_field_comments'));
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // render
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     $output = $crud->render();
     // prepare css & js, add them to config
     $config = array();
     $asset = new Cms_asset();
     foreach ($output->css_files as $file) {
         $asset->add_css($file);
     }
     $config['css'] = $asset->compile_css();
     foreach ($output->js_files as $file) {
         $asset->add_js($file);
     }
     $config['js'] = $asset->compile_js();
     // add values from post
     $this->load->model('blog/article_model');
     $output->title = $this->input->post('title');
     $output->content = $this->article_model->build_content($this->input->post('content'));
     $output->status = $this->input->post('status');
     // show the view
     $this->view($this->cms_module_path() . '/manage_article_view', $output, $this->n('manage_article'), $config);
 }
Exemple #13
0
 public function config()
 {
     $this->cms_guard_page('main_config_management');
     $crud = $this->new_crud();
     $crud->unset_jquery();
     $crud->set_table(cms_table_name('main_config'));
     $crud->set_subject($this->cms_lang('Configuration'));
     $crud->unique_fields('config_name');
     $crud->unset_read();
     $crud->unset_delete();
     $crud->columns('config_name', 'value');
     $crud->edit_fields('config_name', 'value', 'description');
     $crud->add_fields('config_name', 'value', 'description');
     $crud->display_as('config_name', 'Configuration Key')->display_as('value', 'Configuration Value')->display_as('description', 'Description');
     $crud->unset_texteditor('description');
     $crud->unset_texteditor('value');
     $operation = $crud->getState();
     if ($operation == 'edit' || $operation == 'update' || $operation == 'update_validation') {
         $crud->field_type('config_name', 'readonly');
         $crud->field_type('description', 'readonly');
     } else {
         if ($operation == 'add' || $operation == 'insert' || $operation == 'insert_validation') {
             //$crud->set_rules('config_name', 'Configuration Key', 'required');
             $crud->required_fields('config_name');
         }
     }
     $crud->callback_after_insert(array($this, '_after_insert_config'));
     $crud->callback_after_update(array($this, '_after_update_config'));
     $crud->callback_before_delete(array($this, '_before_delete_config'));
     $crud->set_language($this->cms_language());
     $output = $crud->render();
     // prepare css & js, add them to config
     $config = array();
     $asset = new Cms_asset();
     foreach ($output->css_files as $file) {
         $asset->add_css($file);
     }
     $config['css'] = $asset->compile_css();
     foreach ($output->js_files as $file) {
         $asset->add_js($file);
     }
     $config['js'] = $asset->compile_js();
     // show the view
     $this->view('main/main_config', $output, 'main_config_management', $config);
 }
<?php

if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
// include css
$asset = new Cms_asset();
$asset->add_cms_css('grocery_crud/css/jquery_plugins/chosen/chosen.css');
$asset->add_cms_css('grocery_crud/css/ui/simple/jquery-ui-1.10.1.custom.min.css');
echo $asset->compile_css();
?>
<style type="text/css">
	#message:empty{
		display:none;
	}
</style>

<?php 
// include php
$asset->add_cms_js('grocery_crud/js/jquery_plugins/jquery.chosen.min.js');
$asset->add_cms_js('grocery_crud/js/jquery_plugins/ui/jquery-ui-1.10.3.custom.min.js');
echo $asset->compile_js();
?>

<script type="text/javascript">
	var REQUEST_EXISTS = false;
	var REQUEST = "";
    function check_change_profile(){
        var email =  $('input[name="email"]').val();
        var password = $('input[name="password"]').val();
        var confirm_password = $('input[name="confirm_password"]').val();
 protected function render_crud($crud = NULL)
 {
     if ($crud == NULL) {
         $crud = $this->CRUD;
     }
     $output = $crud->render();
     // prepare css and js, add them to config
     $config = array();
     $asset = new Cms_asset();
     foreach ($output->css_files as $file) {
         $asset->add_css($file);
     }
     $config['css'] = $asset->compile_css();
     foreach ($output->js_files as $file) {
         $asset->add_js($file);
     }
     $config['js'] = $asset->compile_js();
     return array('output' => $output, 'config' => $config);
 }
Exemple #16
0
<?php

defined('BASEPATH') or exit('No direct script access allowed');
$asset = new Cms_asset();
$asset->add_cms_css('grocery_crud/css/jquery_plugins/chosen/chosen.css');
$asset->add_cms_css('grocery_crud/themes/no-flexigrid/css/flexigrid.css');
echo $asset->compile_css();
?>
<style type="text/css">
    textarea#description{
        resize: none;
        word-wrap: no-wrap;
        white-space: pre-wrap;
        overflow-x: auto;
        width:95%;
        min-width: 385px!important;
        min-height: 75px!important;
        margin-top: 10px!important;
        font-family: Courier;
        font-size: small;
    }
    .chzn-container-multi .chzn-choices .search-field input{
        height:28px;
    }
</style>
<?php 
echo '<h3> Edit ' . $name . ' sub-site</h3>';
if ($save) {
    echo '<div class="alert alert-success">Changes has been saved</div>';
}
echo form_open_multipart($edit_url, 'class="form form-horizontal"');