Beispiel #1
0
function create_editor($id, $content, $width = 800, $height = 400, $toolbar = 'Default')
{
    $editor_params = get_editor_params();
    $toolbar_content = !empty($editor_params['toolbars'][$toolbar]) ? ", toolbar: " . $editor_params['toolbars'][$toolbar] : '';
    $code = "<script src='{$editor_params['script_src']}'></script>";
    $code .= '<textarea id="' . $id . '" name="' . $id . '" style="width: ' . $width . 'px; height: ' . $height . 'px;">' . $content . '</textarea>';
    $code .= "<script>CKEDITOR.replace('" . $id . "', {language: '" . $editor_params['language'] . "'" . $toolbar_content . "});</script>";
    return $code;
}
 /**
  * Manage dynamic blocks of area
  * 
  * @param integer $id_area area identifier
  * @return void
  */
 public function area_blocks($id_area)
 {
     $blocks = $this->Dynamic_blocks_model->get_blocks_list_by_id();
     $this->template_lite->assign('blocks', $blocks);
     if ($this->input->post('add_block')) {
         $id_block = intval($this->input->post('id_block'));
         if ($id_block) {
             $added_block_data = $blocks[$id_block];
             $attrs["id_area"] = $id_area;
             $attrs["id_block"] = $id_block;
             $attrs["cache_time"] = 0;
             $attrs["sorter"] = $this->Dynamic_blocks_model->get_area_blocks_count($id_area) + 1;
             if (!empty($added_block_data["params_data"])) {
                 foreach ($added_block_data["params_data"] as $param) {
                     $attrs["params"][$param["gid"]] = $param["default"];
                 }
             } else {
                 $attrs["params"] = array();
             }
             $attrs["params"] = serialize($attrs["params"]);
             $attrs["view_str"] = $added_block_data["views_data"][0]["gid"];
             $this->Dynamic_blocks_model->save_area_block(null, $attrs);
             $this->system_messages->add_message('success', l('success_add_area_block', 'dynamic_blocks'));
         }
     }
     $area_blocks = $this->Dynamic_blocks_model->get_area_blocks($id_area);
     if (!empty($area_blocks)) {
         foreach ($area_blocks as $key => $area_block) {
             $area_blocks[$key]["block_data"] = $blocks[$area_block["id_block"]];
         }
     }
     $this->template_lite->assign('area_blocks', $area_blocks);
     $area = $this->Dynamic_blocks_model->get_area_by_id($id_area);
     $this->template_lite->assign('area', $area);
     $this->template_lite->assign("current_lang_id", $this->pg_language->current_lang_id);
     $this->template_lite->assign("langs", $this->pg_language->languages);
     $presets_count = $this->Dynamic_blocks_model->get_presets_count();
     $this->template_lite->assign('presets_count', $presets_count);
     $page = isset($_SESSION["areas_list"]["page"]) ? $_SESSION["areas_list"]["page"] : 1;
     $this->system_messages->set_data('back_link', site_url() . "admin/dynamic_blocks/index/" . $page);
     $this->pg_theme->add_js('admin-multilevel-sorter.js');
     $this->Menu_model->set_menu_active_item('admin_dynblocks_menu', 'areas_list_item');
     $this->system_messages->set_data('header', l('admin_header_area_blocks_edit', 'dynamic_blocks') . ": " . $area["name"]);
     $this->load->plugin('fckeditor');
     $editor_params = get_editor_params();
     $editor_params['upload_url'] = site_url() . 'admin/start/wysiwyg_uploader/dynamic_blocks/';
     $this->template_lite->assign('editor_params', $editor_params);
     $this->template_lite->view('edit_block_list');
 }