Esempio n. 1
0
 function postBycategory()
 {
     //code to load smileys on page....
     $image_array = get_clickable_smileys(asset_url() . 'smileys/', 'postContent');
     $col_array = $this->table->make_columns($image_array, 8);
     $data['smiley_table'] = $this->table->generate($col_array);
     $categoryId = $this->uri->segment(3, 0);
     $data['get_category_By_Id'] = $this->category_model->get_category_By_Id($categoryId);
     if (count($data['get_category_By_Id']) == 0) {
         redirect('');
     } else {
         $data['user_id'] = $this->tank_auth->get_user_id();
         $data['username'] = $this->tank_auth->get_username();
         $data['categories'] = $this->category_model->categories_list();
         $userId = $this->tank_auth->get_user_id();
         $data['getUserdetailsById'] = $this->user_model->getUserdetailsById($userId);
         $data['postContent'] = $this->post_model->getPostByCategoryId($categoryId);
         $data['categories'] = $this->category_model->categories_list();
         $data['get_category_By_Id'] = $this->category_model->get_category_By_Id($categoryId);
         $data['getAllLikeTypes'] = $this->like_model->getAllLikeTypes();
         $likecount = count($data['getAllLikeTypes']);
         if (count($data['postContent']) != 0) {
             for ($i = 0; $i < $likecount; $i++) {
                 foreach ($data['postContent'] as $postid) {
                     $count[$postid->postId] = $this->like_model->getCountLikeByPost($postid->postId, $i + 1);
                     $countcomments[$postid->postId] = $this->post_model->get_Nocomment_by_Postid($postid->postId);
                 }
                 $data['getLikeByPost'][$i] = $count;
                 $data['countComments'] = $countcomments;
             }
         }
         $this->load->view('home', $data);
     }
 }
Esempio n. 2
0
 function index()
 {
     $image_array = get_clickable_smileys(asset_url() . 'smileys/', 'comments');
     $col_array = $this->table->make_columns($image_array, 8);
     $data['smiley_table'] = $this->table->generate($col_array);
     $this->load->view('smiley_view', $data);
 }
Esempio n. 3
0
 function smiley()
 {
     $this->SP->load->helper('smiley');
     $this->SP->load->library('table');
     $image_array = get_clickable_smileys(base_url() . 'asset/images/smileys/');
     $col_array = $this->SP->table->make_columns($image_array, 5);
     $data['smiley_table'] = $this->SP->table->generate($col_array);
     return $data['smiley_table'];
 }
Esempio n. 4
0
 function index()
 {
     $this->load->helper('url');
     $this->load->helper('smiley');
     $this->load->library('table');
     $image_array = get_clickable_smileys(base_url() . 'images/smileys/', 'comments');
     $col_array = $this->table->make_columns($image_array, 8);
     $data['smiley_table'] = $this->table->generate($col_array);
     $this->load->view('smiley_view', $data);
 }
Esempio n. 5
0
 /**
  * [index description]
  * @return [type] [description]
  */
 public function index($id = null)
 {
     $this->load->helper('smiley');
     $this->load->library('table');
     if (!$id) {
         $id = $this->auth_user_id;
     }
     $image_array = get_clickable_smileys(base_url('assets/plugins/emojione/'), 'comments');
     $view['smiley_table'] = $this->table->make_columns($image_array, 12);
     $view['user_profile'] = $this->user_model->getUserProfile($id);
     $view['skills'] = $this->user_model->loadTermsByCategory('skills');
     $view['userSkills'] = array_flip($this->user_model->getUserSkills($this->auth_user_id));
     $data['title'] = "My Profile";
     $data['content'] = $this->load->view('user_profile', $view, true);
     $this->load->view('html', $data);
 }
Esempio n. 6
0
 public function show($material_id)
 {
     $this->load->library('table');
     $this->load->library('captcha_lib');
     // Формируем элементы, нужные в любом случае
     $data = array();
     //Массив по свежим материалам
     $data['latest_materials'] = $this->materials_model->get_latest();
     //Массив по популярным материалам
     $data['popular_materials'] = $this->materials_model->get_popular();
     // Архив
     $data['archive_list'] = $this->administration_model->get_archive();
     // Массив по одному материалу
     $data['main_info'] = $this->materials_model->get($material_id);
     $data['links'] = $this->materials_model->get_links($material_id);
     $data['main_info']['ban_img_url'] = $this->sections_model->get_ban_url_by($material_id);
     // Признак слайдирования баннера
     $data['ban_slide'] = FALSE;
     //Если массив пуст
     if (empty($data['main_info'])) {
         $data['info'] = 'Нет такого материала';
         $name = 'info';
         $this->display_lib->user_info_page($data, $name);
     } else {
         //Формируем массив для обновления поля count_views (текущее число показов материала +1)
         $counter_data = array('count_views' => $data['main_info']['count_views'] + 1);
         //Запускаем функцию обновления, меняющую значение счетчика в базе
         $this->materials_model->update_counter($material_id, $counter_data);
         // Создаем простой индексный массив, содержащий все смайлики
         $img_array = get_clickable_smileys(base_url() . 'img/smileys/', 'comment_text');
         // Путь и id поля
         // Создаем многомерный массив из индексного и передаем, сколько столбцов должно быть в таблице
         $col_array = $this->table->make_columns($img_array, 15);
         // Сообщение, если неправильно введена капча
         $data['fail_captcha'] = '';
         // Сообщение, если комментарий успешно добавлен
         $data['success_comment'] = '';
         //Получаем код капчи
         $data['imgcode'] = $this->captcha_lib->captcha_actions();
         // Комментарии к материалу
         $data['comments_list'] = $this->comments_model->get_by($material_id);
         //Таблица смайлов
         $data['smiley_table'] = $this->table->generate($col_array);
         $name = 'materials/content';
         $this->display_lib->user_mat_page($data, $name);
     }
 }
Esempio n. 7
0
 function getPost()
 {
     $smileVal = '';
     $ext = '';
     $image_array = get_clickable_smileys(asset_url() . 'smileys/', 'commentText');
     $col_array = $this->table->make_columns($image_array, 8);
     $data['smiley_table'] = $this->table->generate($col_array);
     //foreach($data['smiley_table'] as $smiles){$smileVal=$smiles;}
     if ($this->tank_auth->is_logged_in()) {
         $user_id = $this->tank_auth->get_user_id();
     } else {
         $user_id = 1;
     }
     $PostId = $_POST['str'];
     $data['get_post_by_id'] = $this->post_model->get_post_by_id($PostId);
     $noofcomment = $this->post_model->get_Nocomment_by_Postid($PostId);
     foreach ($data['get_post_by_id'] as $value) {
         if ($value->postBG != "") {
             $style = "width:558px;height:auto;padding:20px;word-wrap:break-word;color:#fff;background-image:url('" . asset_url() . "img/bg/" . $value->postBG . "')";
         } else {
             $style = "width:558px;height:auto;padding:20px;word-wrap:break-word;";
         }
         //we can add gender after username in comment by adding this line (<small><a href='#'>Gender</a></small>)
         $show = "\n\t <div class='modal-dialog'>\n                <div class='modal-content'>\n                    <div class='modal-header'>\n                        <button type='button' class='close' data-dismiss='modal' aria-hidden='true'>&times;</button>\n                        <h4 class='modal-title text-primary'><a type='button' class='btn btn-primary btn-circle'><i class='fa fa-comment'></i></a>&nbsp;\t\t\t\t\t\t\t\t                 <strong>POST</strong></h4>\n                    </div>\n                    \n                    <div class='modal-body'>\n                   <h3 class='timeline-header'><a href='#'>" . $value->categories_name . "</a>&nbsp; By " . $value->username . "</h3>\n                     <div class='timeline-body text-center' style=" . $style . "> " . parse_smileys($value->postContent, asset_url() . "smileys/") . "";
         if ($value->postFileContent != '') {
             $ext = explode('.', $value->postFileContent);
             if ($ext[1] == 'jpg' || $ext[1] == 'jpeg' || $ext[1] == 'gif' || $ext[1] == 'png' || $ext[1] == 'JPG' || $ext[1] == 'PNG' || $ext[1] == 'JPEG') {
                 $show .= '<img class="rcimg" src=' . asset_url() . 'UploadFiles/' . $value->postFileContent . '>';
             } elseif ($ext[1] == 'avi' || $ext[1] == 'flv' || $ext[1] == 'wmv' || $ext[1] == 'mp4') {
                 $show .= "  <video width='400' controls>\n                                            <source src='" . asset_url() . 'UploadFiles/' . $value->postFileContent . "' type='video/'" . $ext[1] . "''>                                             </video>";
             }
         }
         $show .= "</div>&nbsp\n\t\t\t\t\t\t\t\t\t\t <!-- Chat box -->\n                            <div class='box box-success' id='comment_box'>\n                                <div class='box-header'> \n                                 <span style='margin-top:6px;' class='btn btn-primary btn-circle pull-left' ><i class='fa fa-comments'></i></span>\n                                 <h3 class='box-title'> Comments</h3>\n                                </div>\n\t\t\t\t\t\t\t\t";
         $show .= "<div class='box-body chat scroll' id='chat-box'><!--open chat item -->";
         if ($noofcomment > 0) {
             $data['getCommentBYPostId'] = $this->post_model->get_comment_by_Postid($PostId);
             foreach ($data['getCommentBYPostId'] as $commentvalue) {
                 $divide = explode(' ', $commentvalue->commentAt);
                 $date = explode('-', $divide[0]);
                 $year = $date[0];
                 $month = $date[1];
                 $day = $date[2];
                 $time = date("d M. Y", mktime(0, 0, 0, $month, $day, $year));
                 $userimg = $commentvalue->user_image;
                 if ($userimg == '') {
                     $userpath = "img/avatar3.png";
                 } else {
                     $userpath = "img/profile_pics/" . $userimg;
                 }
                 $show .= "<div class='item'>\n                                       <img src='" . asset_url() . $userpath . "' alt='user image' class='offline pull-left' />\n                                     <p class='message'><small class='text-muted pull-right'>\n\t\t\t\t\t\t\t\t\t\t\t\t<i class='fa fa-clock-o'></i> " . $divide[1] . "-" . $time . "\n\t\t\t\t\t\t\t\t\t\t\t<a href='#' data-toggle='modal' data-target='#ReportComment-modal' rel='tooltip' \n\t\t\t\t\t\t\t\t\t\tdata-original-title='" . $this->lang->line('report_abuse') . "' onClick='setCommentid(" . $commentvalue->commentId . ");'>\n                                     " . $this->lang->line('report_abuse') . "\n                                       </a> </small> <a href='' class='name'><small> " . $commentvalue->username . "</small></a>\n                                          </p>  <p class='message13'><small> " . parse_smileys(wordwrap($commentvalue->commentText, '65', '<br>', true), asset_url() . "smileys/") . "\n                                      </small> </p>\n                                    </div>";
             }
         }
         $show .= "</div>\n\t\t\t <div class='box-footer'>\n\t\t\t  <!--<form action='" . base_url() . "Posts/doComment'  method='post' onclick='return getlocaltimeComment()'>-->\n                                    <div class='input-group'>\n\t\t\t\t\t\t\t\t\t<input type='hidden' name='gettimeComment' id='gettimeComment' value=''/>\n                                   <input type='hidden' name='userid' id='userid' value='" . $user_id . "'/>\n                                    <input type='hidden' name='postid' id='postid' value='" . $PostId . "'/>\n                                 <input class='form-control' name='commentText' id='commentText' type='text' placeholder='Type comment...'/>\n\t\t\t\t\t\t<div class='input-group-btn'>\n                                            <button type='submit' class='btn btn-warning dropdown-toggle'  data-toggle='dropdown' rel='tooltip' data-original-title='Smileys'><i class='fa fa-smile-o'></i></button>\n\t\t\t\t\t\t\t\t\t\t\t<ul class='dropdown-menu'>\n                                <li class='header'>&nbsp; Smileys</li>\n                                <li>" . $data['smiley_table'] . "\n                                </li>\n                            \n                        </li></ul>\n                                        </div>\n\t\t\t\t\t\t <div class='input-group-btn'>\n                                            <button type='submit' class='btn btn-success' onClick='Commentvalue()'><i class='fa fa-plus'></i></button>\n                                        </div>\n\t\t\t\t\t\t</div>\n                                    </div><!--</form> -->\n                               </div><!-- /.footer -->\n                            </div><!-- /.box (chat box) -->\n                            </div>\n                    \n                </div><!-- /.modal-content -->\n            </div><!-- /.modal-dialog -->";
         echo $show;
         echo smiley_js();
     }
 }
 /**
  * Build Smiley Table
  *
  * This function builds the smiley table for a given field.
  *
  * @param 	string 	Field Name
  * @return 	string 	Smiley Table HTML
  */
 private function _build_smiley_table($field_name)
 {
     $this->load->library('table');
     $this->table->set_template(array('table_open' => '<table style="text-align: center; margin-top: 5px;" class="mainTable padTable smileyTable">'));
     $image_array = get_clickable_smileys($this->config->slash_item('emoticon_url'), $field_name);
     $col_array = $this->table->make_columns($image_array, 8);
     $smilies = '<div class="smileyContent" style="display: none;">';
     $smilies .= $this->table->generate($col_array) . '</div>';
     $this->table->clear();
     return $smilies;
 }
Esempio n. 9
0
    /**
     * Build Spellcheck 
     *
     * @param string
     * @param array
     * @param array
     */
    function _build_spellcheck($chunk, $row, $settings)
    {
        /*
        array
          'field_show_smileys' => string 'y' (length=1)
          'field_show_glossary' => string 'y' (length=1)
          'field_show_spellcheck' => string 'y' (length=1)
          'field_show_formatting_btns' => string 'y' (length=1)
          'field_show_file_selector' => string 'y' (length=1)
          'field_show_writemode' => string 'y' (length=1)
        */
        // Unset formatting buttons choice, we've already dealt with it.
        unset($settings['field_show_formatting_btns']);
        foreach ($settings as $key => $val) {
            if ($val == 'n') {
                unset($settings[$key]);
            }
        }
        if (empty($settings)) {
            return $chunk;
        }
        $output = '<div class="spellcheck markitup">';
        // Commented out for the time being while we decide on what to do regarding
        // Thickbox.  @see _writemode_markup();
        // if (isset($settings['field_show_writemode']))
        // {
        // 	$output .= '<a href="#TB_inline?height=100%'.AMP.'width=100%'.AMP.'modal=true'.AMP.'inlineId=write_mode_container" class="write_mode_trigger thickbox" id="id_'.$row['field_id'].'"><img src="'.$this->theme_url.'images/publish_write_mode.png" /></a>';
        // }
        if (isset($settings['field_show_file_selector'])) {
            $output .= '<a href="#" class="markItUpButton">
			<img class="file_manipulate js_show" src="' . $this->theme_url . 'images/publish_format_picture.gif" alt="' . lang('file') . '" /></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
        }
        if ($this->_installed_mods['spellcheck'] && isset($settings['field_show_spellcheck'])) {
            $id = ctype_digit($row['field_id']) ? 'field_id_' : '';
            $output .= '<a href="#" class="spellcheck_link" id="' . $id . $row['field_id'] . '" title="' . lang('check_spelling') . '"><img src="' . $this->theme_url . 'images/spell_check_icon.png" alt="' . lang('check_spelling') . '" /></a>';
            // $output .= '<a href="#" class="spellcheck_link" id="spelltrigger_'.(ctype_digit($row['field_id']))?'field_id_':''.$row['field_id'].'" title="'.lang('check_spelling').'"><img src="images/spell_check_icon.png" style="margin-bottom: -8px;" alt="'.lang('check_spelling').'" /></a>';
        }
        if (isset($settings['field_show_glossary'])) {
            $output .= '<a href="#" class="glossary_link" title="' . lang('glossary') . '"><img src="' . $this->theme_url . 'images/spell_check_glossary.png" alt="' . lang('glossary') . '" /></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
        }
        if ($this->_installed_mods['smileys']) {
            $this->EE->load->helper('smiley');
            $this->EE->load->library('table');
            $output .= '<a href="#" id="smiley_link_' . $row['field_id'] . '" class="smiley_link" title="' . lang('emotions') . '">' . lang('emotions') . '</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
            $image_array = get_clickable_smileys($path = $this->EE->config->slash_item('emoticon_path'), 'field_id_' . $row['field_id']);
            $col_array = $this->EE->table->make_columns($image_array, 8);
            $output .= '<div id="smiley_table_' . $row['field_id'] . '" class="smileyContent" style="display: none;">' . $this->EE->table->generate($col_array) . '</div>';
            $this->EE->table->clear();
            // clear out tables for the next smiley
        }
        if (isset($row['field_show_fmt']) && $row['field_show_fmt'] == 'y') {
        }
        if (isset($settings['field_show_glossary'])) {
            $tmp = $this->EE->load->_ci_view_path;
            $this->EE->load->_ci_view_path = PATH_THEMES . 'cp_themes/default/';
            $output .= $this->EE->load->view('content/_assets/glossary_items', '', TRUE);
            $this->EE->load->_ci_view_path = $tmp;
        }
        $output .= '</div>';
        $chunk = str_replace(LD . 'spellcheck' . RD, $output, $chunk);
        return $chunk;
    }
Esempio n. 10
0
 function top()
 {
     if (!$this->tank_auth->is_logged_in()) {
         $image_array = get_clickable_smileys(asset_url() . 'smileys/', 'postContent');
         $col_array = $this->table->make_columns($image_array, 8);
         $data['smiley_table'] = $this->table->generate($col_array);
         $data['categories'] = $this->category_model->categories_list();
         $userId = $this->tank_auth->get_user_id();
         //$data['getUserdetailsById']= $this->user_model->getUserdetailsById($userId);
         //$data['postContent'] = $this->post_model->post_list();
         $data['postContent'] = $this->like_model->getTopPostByLike();
         $data['getAllLikeTypes'] = $this->like_model->getAllLikeTypes();
         $likecount = count($data['getAllLikeTypes']);
         for ($i = 0; $i < $likecount; $i++) {
             foreach ($data['postContent'] as $postid) {
                 $count[$postid->postId] = $this->like_model->getCountLikeByPost($postid->postId, $i + 1);
                 $countcomments[$postid->postId] = $this->post_model->get_Nocomment_by_Postid($postid->postId);
             }
             $data['getLikeByPost'][$i] = $count;
             $data['countComments'] = $countcomments;
         }
         // print_r($data['getTopLikeByPost']);
         $this->load->view('top', $data);
     } else {
         $image_array = get_clickable_smileys(asset_url() . 'smileys/', 'postContent');
         $col_array = $this->table->make_columns($image_array, 8);
         $data['smiley_table'] = $this->table->generate($col_array);
         $data['user_id'] = $this->tank_auth->get_user_id();
         $data['username'] = $this->tank_auth->get_username();
         $data['categories'] = $this->category_model->categories_list();
         $userId = $this->tank_auth->get_user_id();
         $data['getUserdetailsById'] = $this->user_model->getUserdetailsById($userId);
         $data['postContent'] = $this->like_model->getTopPostByLike();
         $data['getAllLikeTypes'] = $this->like_model->getAllLikeTypes();
         $likecount = count($data['getAllLikeTypes']);
         for ($i = 0; $i < $likecount; $i++) {
             foreach ($data['postContent'] as $postid) {
                 $count[$postid->postId] = $this->like_model->getCountLikeByPost($postid->postId, $i + 1);
                 $countcomments[$postid->postId] = $this->post_model->get_Nocomment_by_Postid($postid->postId);
             }
             $data['getLikeByPost'][$i] = $count;
             $data['countComments'] = $countcomments;
         }
         $this->load->view('top', $data);
     }
 }
Esempio n. 11
0
 public function add($material_id = '')
 {
     $this->load->library('table');
     $this->load->library('captcha_lib');
     $this->load->library('typography');
     // Подготавливаем массив с картинками-смайлами
     $img_array = get_clickable_smileys(base_url() . 'img/smileys/', 'comment_text');
     $col_array = $this->table->make_columns($img_array, 15);
     $data = array();
     //Массив по свежим материалам
     $data['latest_materials'] = $this->materials_model->get_latest();
     //Массив по популярным материалам
     $data['popular_materials'] = $this->materials_model->get_popular();
     // Архив
     $data['archive_list'] = $this->administration_model->get_archive();
     //Массив по одному материалу
     $data['main_info'] = $this->materials_model->get($material_id);
     // Комментарии к материалу
     $data['comments_list'] = $this->comments_model->get_by($material_id);
     // Готовая таблица смайлов
     $data['smiley_table'] = $this->table->generate($col_array);
     $data['links'] = $this->comments_model->get_links($material_id);
     $data['main_info']['ban_img_url'] = $this->sections_model->get_ban_url_by($material_id);
     // Признак слайдирования баннера
     $data['ban_slide'] = FALSE;
     // Не нажата кнопка "Комментировать"
     if (!isset($_POST['post_comment'])) {
         $data['info'] = 'Вы обратились к файлу напрямую, не нажав кнопку "Комментировать"';
         $name = 'info';
         $this->display_lib->user_info_page($data, $name);
     } else {
         //Установка правил валидации
         $this->form_validation->set_rules($this->comments_model->add_rules);
         $val_res = $this->form_validation->run();
         // Если валидация пройдена
         if ($val_res == TRUE) {
             //Получаем значение поля капча
             $entered_captcha = $this->input->post('captcha');
             //Если оно совпадает со значением в сессии (значение там уже есть - сессия с цифрами капчи создается
             //при просмотре материала, а комментирование идет только со страницы материала)
             if ($entered_captcha == $this->session->userdata('rnd_captcha')) {
                 $comment_text = $this->input->post('comment_text');
                 // TRUE - более двух переводов строки все равно считаются за два перевода
                 $comment_text = $this->typography->auto_typography($comment_text, TRUE);
                 $comment_text = parse_smileys($comment_text, base_url() . 'img/smileys/');
                 // Массив для вставки данных по комментарию
                 $comment_data = array();
                 //Уже передан как параметр функции add
                 $comment_data['material_id'] = $material_id;
                 $comment_data['author'] = $this->input->post('author');
                 $comment_data['comment_text'] = $comment_text;
                 $comment_data['date'] = date('Y-m-d');
                 //Вставляем комментарий в базу
                 $this->comments_model->add_new($comment_data);
                 //Готовим данные для отправки письма-оповещения администратору
                 //Имя отправителя
                 $author = $this->input->post('author');
                 // Переносы после 70 знаков (ограничение функции mail в PHP)
                 $comment_text = wordwrap($comment_text, 70);
                 // Удаляем html-тэги для удобства чтения
                 $comment_text = strip_tags($comment_text);
                 //Куда отправляется письмо
                 //$address = "*****@*****.**";
                 //$address = "";
                 // Тема письма
                 $subject = "Комментарий к материалу: " . $data['main_info']['title'];
                 // Сообщение
                 $message = "Написал(а):{$author}\nТекст комментария:\n{$comment_text}\nСсылка: http://abclass.ru/materials/{$material_id}#captcha";
                 // Оправляем письмо-оповощение
                 mail($address, $subject, $message, "Content-type:text/plain;charset = utf-8\r\n");
                 $data['fail_captcha'] = '';
                 $data['success_comment'] = 'Ваш комментарий успешно добавлен<br><a href="#new_comment">Просмотреть комментарий</a>';
                 //получаем код капчи
                 $data['imgcode'] = $this->captcha_lib->captcha_actions();
                 //Получаем список комментариев к материалу заново (так как только что был добавлен новый комментарий)
                 $data['comments_list'] = $this->comments_model->get_by($material_id);
                 $name = 'materials/content';
                 $this->display_lib->user_mat_page($data, $name);
             } else {
                 $data['fail_captcha'] = 'Неверно введены цифры с картинки<br><a href="#captcha">Ввести еще раз!<a>';
                 //получаем код капчи
                 $data['imgcode'] = $this->captcha_lib->captcha_actions();
                 $data['success_comment'] = '';
                 $name = 'materials/content';
                 $this->display_lib->user_mat_page($data, $name);
             }
         } else {
             $data['fail_captcha'] = '';
             $data['imgcode'] = $this->captcha_lib->captcha_actions();
             //получаем код капчи
             $data['success_comment'] = '';
             $name = 'materials/content';
             $this->display_lib->user_page($data, $name);
         }
     }
 }
Esempio n. 12
0
 public function smiley_helper()
 {
     //DEPRECATED
     $this->load->helper('smiley');
     $this->load->library('table');
     $image_array = get_clickable_smileys(base_url('/smileys'), 'comments');
     $col_array = $this->table->make_columns($image_array, 8);
     $data['smiley_table'] = $this->table->generate($col_array);
     //$image_array = smiley_js("comment_textarea_alias", "comments");
     $str = 'Here are some smileys: :-)  ;-)';
     $str = parse_smileys($str, base_url('/smileys'));
     echo $str;
     $this->load->view('smiley_view', $data);
     //get_clickable_smileys($image_url[, $alias = ''[, $smileys = NULL]]
     //smiley_js([$alias = ''[, $field_id = ''[, $inline = TRUE]]])
     //parse_smileys([$str = ''[, $image_url = ''[, $smileys = NULL]]])
 }
 function __construct($ThreadId)
 {
     parent::__construct('comments/add');
     $this->mThreadId = $ThreadId;
     $CI =& get_instance();
     $CI->load->helper('smiley');
     $CI->load->library('table');
     // Make the smileys available to the view.
     $image_array = get_clickable_smileys('/images/smileys/');
     $col_array = $CI->table->make_columns($image_array, 8);
     $smiley_table = $CI->table->generate($col_array);
     $this->SetData('SmileyTable', $smiley_table);
     $this->SetData('DefaultIdentity', $CI->user_auth->entityId);
     $this->SetData('DefaultAnonymous', FALSE);
     $this->SetData('DefaultContent', '');
     $this->SetData('Preview', NULL);
     $this->SetData('ShowCancelButton', false);
     $this->SetData('AlreadyExists', false);
 }
Esempio n. 14
0
    function display_field($data)
    {
        if (isset($this->settings['field_show_formatting_btns']) && $this->settings['field_show_formatting_btns'] == 'y' && !ee()->session->cache(__CLASS__, 'markitup_initialized')) {
            $member = ee('Model')->get('Member', ee()->session->userdata('member_id'))->first();
            $buttons = $member->getHTMLButtonsForSite(ee()->config->item('site_id'));
            $markItUp = array('nameSpace' => 'html', 'markupSet' => array());
            foreach ($buttons as $button) {
                $markItUp['markupSet'][] = $button->prepForJSON();
            }
            ee()->javascript->set_global('markitup.settings', $markItUp);
            ee()->cp->add_js_script(array('plugin' => array('markitup')));
            ee()->javascript->output('$("textarea[data-markitup]").markItUp(EE.markitup.settings);');
            ee()->session->set_cache(__CLASS__, 'markitup_initialized', TRUE);
        }
        // Set a boolean telling if we're in Grid AND this textarea has
        // markItUp enabled
        $grid_markitup = $this->content_type() == 'grid' && isset($this->settings['show_formatting_buttons']) && $this->settings['show_formatting_buttons'] == 1;
        if ($grid_markitup) {
            // Load the Grid cell display binding only once
            if (!ee()->session->cache(__CLASS__, 'grid_js_loaded')) {
                ee()->javascript->output('
					Grid.bind("textarea", "display", function(cell)
					{
						var textarea = $("textarea.markItUp", cell);

						// Only apply file browser trigger if a field was found
						if (textarea.size())
						{
							textarea.markItUp(EE.markitup.settings);
							EE.publish.file_browser.textarea(cell);
						}
					});
				');
                ee()->session->set_cache(__CLASS__, 'grid_js_loaded', TRUE);
            }
        }
        if (REQ == 'CP') {
            $class = $grid_markitup ? 'markItUp' : '';
            $toolbar = FALSE;
            $format_options = array('field_show_smileys', 'field_show_file_selector');
            foreach ($format_options as $option) {
                if (isset($this->settings[$option]) && $this->settings[$option] == 'y') {
                    $toolbar = TRUE;
                    $class .= ' has-format-options';
                    break;
                }
            }
            $format_options = array();
            if (isset($this->settings['field_show_fmt']) && $this->settings['field_show_fmt'] == 'y') {
                ee()->load->model('addons_model');
                $format_options = ee()->addons_model->get_plugin_formatting(TRUE);
            }
            ee()->cp->get_installed_modules();
            ee()->load->helper('smiley');
            ee()->load->library('table');
            $smileys_enabled = isset(ee()->cp->installed_modules['emoticon']) ? TRUE : FALSE;
            $smileys = '';
            if ($smileys_enabled) {
                $image_array = get_clickable_smileys(ee()->config->slash_item('emoticon_url'), $this->name());
                $col_array = ee()->table->make_columns($image_array, 8);
                $smileys = ee()->table->generate($col_array);
                ee()->table->clear();
            }
            $vars = array('name' => $this->name(), 'settings' => $this->settings, 'value' => $data, 'class' => trim($class), 'toolbar' => $toolbar, 'format_options' => $format_options, 'smileys_enabled' => $smileys_enabled, 'smileys' => $smileys);
            if (isset($this->settings['field_show_file_selector']) && $this->settings['field_show_file_selector'] == 'y') {
                $fp = new FilePicker();
                $fp->inject(ee()->view);
                $vars['fp_url'] = ee('CP/URL')->make($fp->controller, array('directory' => 'all'));
                ee()->cp->add_js_script(array('file' => array('fields/textarea/cp'), 'plugin' => array('ee_txtarea')));
            }
            return ee('View')->make('textarea:publish')->render($vars);
        }
        return form_textarea(array('name' => $this->name(), 'value' => $data, 'rows' => $this->settings['field_ta_rows'], 'dir' => $this->settings['field_text_direction'], 'class' => $grid_markitup ? 'markItUp' : ''));
    }