protected function setGlobalJs($entry, $valid) { $entry_id = $entry->entry_id; $channel_id = $entry->channel_id; $autosave_interval_seconds = ee()->config->item('autosave_interval_seconds') === FALSE ? 60 : ee()->config->item('autosave_interval_seconds'); // Create Foreign Character Conversion JS include APPPATH . 'config/foreign_chars.php'; /* ------------------------------------- /* 'foreign_character_conversion_array' hook. /* - Allows you to use your own foreign character conversion array /* - Added 1.6.0 * - Note: in 2.0, you can edit the foreign_chars.php config file as well */ if (isset(ee()->extensions->extensions['foreign_character_conversion_array'])) { $foreign_characters = ee()->extensions->call('foreign_character_conversion_array'); } /* /* -------------------------------------*/ $smileys_enabled = isset(ee()->cp->installed_modules['emoticon']) ? TRUE : FALSE; if ($smileys_enabled) { ee()->load->helper('smiley'); ee()->cp->add_to_foot(smiley_js()); } ee()->javascript->set_global(array('lang.add_new_html_button' => lang('add_new_html_button'), 'lang.close' => lang('close'), 'lang.confirm_exit' => lang('confirm_exit'), 'lang.loading' => lang('loading'), 'publish.autosave.interval' => (int) $autosave_interval_seconds, 'publish.autosave.URL' => ee('CP/URL')->make('publish/autosave/' . $channel_id . '/' . $entry_id)->compile(), 'publish.add_category.URL' => ee('CP/URL')->make('channels/cat/createCat/###')->compile(), 'publish.foreignChars' => $foreign_characters, 'publish.lang.no_member_groups' => lang('no_member_groups'), 'publish.lang.refresh_layout' => lang('refresh_layout'), 'publish.lang.tab_count_zero' => lang('tab_count_zero'), 'publish.lang.tab_has_req_field' => lang('tab_has_req_field'), 'publish.markitup.foo' => FALSE, 'publish.smileys' => $smileys_enabled, 'publish.field.URL' => ee('CP/URL', 'publish/field/' . $channel_id . '/' . $entry_id)->compile(), 'publish.which' => $entry_id ? 'edit' : 'new', 'publish.word_separator' => ee()->config->item('word_separator') != "dash" ? '_' : '-', 'user.can_edit_html_buttons' => ee()->cp->allowed_group('can_edit_html_buttons'), 'user.foo' => FALSE, 'user_id' => ee()->session->userdata('member_id'))); // ------------------------------------------- // Publish Page Title Focus - makes the title field gain focus when the page is loaded // // Hidden Configuration Variable - publish_page_title_focus => Set focus to the tile? (y/n) ee()->javascript->set_global('publish.title_focus', FALSE); if (!$entry_id && $valid && bool_config_item('publish_page_title_focus')) { ee()->javascript->set_global('publish.title_focus', TRUE); } }
/** * Combo Load */ public function combo_load() { ee()->load->library('javascript_loader'); ee()->javascript_loader->combo_load(); if (ee()->input->get('include_jquery') == 'y') { ee()->output->set_output(file_get_contents(PATH_JQUERY . 'jquery.js') . "\n\n" . ee()->output->get_output()); } if (ee()->input->get('use_live_url') == 'y') { ee()->output->append_output(ee()->channel_form->_url_title_js() . "\n\n"); } ee()->load->helper('smiley'); ee()->output->append_output((ee()->config->item('use_compressed_js') != 'n' ? str_replace(array("\n", "\t"), '', smiley_js('', '', FALSE)) : smiley_js('', '', FALSE)) . "\n\n"); ee()->output->append_output(file_get_contents($this->js_path . 'channel_form.js')); ee()->output->set_header('Content-Length: ' . strlen(ee()->output->get_output())); }
/** * Combo Load */ public function combo_load() { parent::combo_load(); if ($this->input->get('include_jquery') == 'y') { $this->output->set_output(file_get_contents(PATH_JQUERY . 'jquery.js') . "\n\n" . $this->output->get_output()); } $this->safecracker->load_channel_standalone(); if ($this->input->get('use_live_url') == 'y') { $this->output->append_output($this->safecracker->channel_standalone->_url_title_js() . "\n\n"); } $this->load->helper('smiley'); $this->output->append_output(($this->config->item('use_compressed_js') != 'n' ? str_replace(array("\n", "\t"), '', smiley_js('', '', FALSE)) : smiley_js('', '', FALSE)) . "\n\n"); $this->output->append_output(file_get_contents($this->js_path . 'saef.js')); $this->output->set_header('Content-Length: ' . strlen($this->output->get_output())); }
echo $_SERVER['REMOTE_ADDR']; ?> " </div> </div> <div class="modal-footer"><input type="submit" class="btn btn-primary" name="submit" value="<?php echo $this->lang->line('report'); ?> "></div> </div><!-- /.modal-content --> </form> </div><!-- /.modal-dialog -->"; </div><!-- /.modal --> <?php echo smiley_js(); ?> <script type="text/javascript"> $(document).ready(function(){ $("#language").on("change",function(){ var lang = $("#language").val(); $.post('<?php echo site_url("welcome/language_ajax"); ?> ',{lang:lang},function(data){ window.location.reload(); }); }) }); </script>
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'>×</button>\n <h4 class='modal-title text-primary'><a type='button' class='btn btn-primary btn-circle'><i class='fa fa-comment'></i></a> \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> 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> \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'> 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(); } }
/** * Entry Form * * Handles new and existing entries. Self submits to save. * * @return void */ public function entry_form() { $this->load->library('form_validation'); // Needed for custom tabs loaded by layout_model from the db table // exp_layout_publish where the whole layout (fields and tabs) are // stored in serialized form. This language file contains the // localized names for the fields and tabs. We may want to push // this call deeper down the rabbit hole so that it is simply // always available whenever we load the layout_model. Or this // may be the only spot we use it. Not sure, so sticking it // here for now. -Daniel B. $this->lang->loadfile('publish_tabs_custom'); $entry_id = (int) $this->input->get_post('entry_id'); $channel_id = (int) $this->input->get_post('channel_id'); $autosave = $this->input->get_post('use_autosave') == 'y'; // If we're autosaving and this isn't a submitted form if ($autosave and empty($_POST)) { $autosave_entry_id = $entry_id; $autosave_data = $this->db->get_where('channel_entries_autosave', array('entry_id' => $entry_id)); $autosave_data = $autosave_data->row(); $entry_id = $autosave_data->original_entry_id; } else { $autosave_entry_id = FALSE; } $this->_smileys_enabled = isset($this->cp->installed_modules['emoticon']) ? TRUE : FALSE; if ($this->_smileys_enabled) { $this->load->helper('smiley'); $this->cp->add_to_foot(smiley_js()); } // Grab the channel_id associated with this entry if // required and make sure the current member has access. $channel_id = $this->_member_can_publish($channel_id, $entry_id, $autosave_entry_id); // If they're loading a revision, we stop here $this->_check_revisions($entry_id); // Get channel data $this->_channel_data = $this->_load_channel_data($channel_id); // Grab, fields and entry data $entry_data = $this->_load_entry_data($channel_id, $entry_id, $autosave_entry_id); $field_data = $this->_set_field_settings($entry_id, $entry_data); $entry_id = $entry_data['entry_id']; // Merge in default fields $deft_field_data = $this->_setup_default_fields($this->_channel_data, $entry_data); $field_data = array_merge($field_data, $deft_field_data); $field_data = $this->_setup_field_blocks($field_data, $entry_data); $this->_set_field_validation($this->_channel_data, $field_data); // @todo setup validation for categories, etc? // @todo third party tabs $this->form_validation->set_message('title', lang('missing_title')); $this->form_validation->set_message('entry_date', lang('missing_date')); $this->form_validation->set_error_delimiters('<div class="notice">', '</div>'); if ($this->form_validation->run() === TRUE) { if ($this->_save($channel_id, $entry_id) === TRUE) { // under normal circumstances _save will redirect // if we get here, a hook triggered end_script return; } // used in _setup_layout_styles // @todo handle generic api errors $this->errors = $this->api_channel_entries->errors; } $this->_setup_file_list(); // get all member groups with cp access for the layout list $member_groups_laylist = array(); $listable = $this->member_model->get_member_groups(array('can_access_admin', 'can_access_edit'), array('can_access_content' => 'y')); foreach ($listable->result() as $group) { if ($group->can_access_admin == 'y' or $group->can_access_edit == 'y') { $member_groups_laylist[] = array('group_id' => $group->group_id, 'group_title' => $group->group_title); } } // Set default tab labels // They may be overwritten or added to in the steps below $this->_tab_labels = array('publish' => lang('publish'), 'categories' => lang('categories'), 'pings' => lang('pings'), 'options' => lang('options'), 'date' => lang('date')); if (isset($this->_channel_data['enable_versioning']) && $this->_channel_data['enable_versioning'] == 'y') { $this->_tab_labels['revisions'] = lang('revisions'); } // Load layouts - we'll need them for the steps below // if this is a layout group preview, we'll use it, otherwise, we'll use the author's group_id $layout_info = $this->_load_layout($channel_id); // Merge layout data (mostly width and visbility) into field data for use on the publish page $field_data = $this->_set_field_layout_settings($field_data, $layout_info); // First figure out what tabs to show, and what fields // they contain. Then work through the details of how // they are show. $tab_hierarchy = $this->_setup_tab_hierarchy($field_data, $layout_info); $layout_styles = $this->_setup_layout_styles($field_data, $layout_info); $field_list = $this->_sort_field_list($field_data); // @todo admin only? or use as master list? skip sorting for non admins, but still compile? $field_list = $this->_prep_field_wrapper($field_list); $field_output = $this->_setup_field_display($field_data); // Start to assemble view data // WORK IN PROGRESS, just need a few things on the page to // work with the html - will clean this crap up $this->load->library('filemanager'); $this->load->helper('snippets'); $this->load->library('file_field'); $this->file_field->browser(); $this->cp->add_js_script(array('ui' => array('datepicker', 'resizable', 'draggable', 'droppable'), 'plugin' => array('markitup', 'toolbox.expose', 'overlay', 'tmpl', 'ee_url_title'), 'file' => array('json2', 'cp/publish', 'cp/publish_tabs'))); if ($this->session->userdata('group_id') == 1) { $this->cp->add_js_script(array('file' => 'cp/publish_admin')); } $this->_set_global_js($entry_id); reset($tab_hierarchy); $this->_markitup(); $parts = $_GET; unset($parts['S'], $parts['D']); $current_url = http_build_query($parts, '', '&'); $autosave_id = $autosave ? $autosave_entry_id : 0; // Remove 'layout_preview' from the URL, stripping anything after it if (strpos($current_url, 'layout_preview') !== FALSE) { $preview_url = explode(AMP . 'layout_preview=', $current_url, 2); $preview_url = $preview_url[0]; } else { $preview_url = $current_url; } $data = array('message' => '', 'cp_page_title' => $entry_id ? lang('edit_entry') : lang('new_entry') . ': ' . $this->_channel_data['channel_title'], 'tabs' => $tab_hierarchy, 'first_tab' => key($tab_hierarchy), 'tab_labels' => $this->_tab_labels, 'field_list' => $field_list, 'layout_styles' => $layout_styles, 'field_output' => $field_output, 'layout_group' => is_numeric($this->input->get_post('layout_preview')) ? $this->input->get_post('layout_preview') : $this->session->userdata('group_id'), 'spell_enabled' => TRUE, 'smileys_enabled' => $this->_smileys_enabled, 'current_url' => $current_url, 'file_list' => $this->_file_manager['file_list'], 'show_revision_cluster' => $this->_channel_data['enable_versioning'], 'member_groups_laylist' => $member_groups_laylist, 'hidden_fields' => array('entry_id' => $entry_id, 'channel_id' => $channel_id, 'autosave_entry_id' => $autosave_id, 'filter' => $this->input->get_post('filter')), 'preview_url' => $preview_url); $this->cp->set_breadcrumb(BASE . AMP . 'C=content_publish', lang('publish')); $this->javascript->compile(); $this->load->view('content/publish', $data); }
/** * Combo Loaded Javascript for the Stand-Alone Entry Form * * Given the heafty amount of javascript needed for this form, we don't * want to kill page speeds, so we're going to combo load what is needed * * @return void */ function saef_javascript() { $scripts = array('ui' => array('core', 'widget', 'button', 'dialog'), 'plugins' => array('scrollable', 'scrollable.navigator', 'ee_filebrowser', 'markitup', 'thickbox')); $type = $this->EE->config->item('use_compressed_js') == 'n' ? 'src' : 'compressed'; if (!defined('PATH_JQUERY')) { define('PATH_JQUERY', PATH_THEMES . 'javascript/' . $type . '/jquery/'); } $output = ''; foreach ($scripts as $key => $val) { foreach ($val as $script) { $filename = $key == 'ui' ? 'jquery.ui.' . $script . '.js' : $script . '.js'; $output .= file_get_contents(PATH_JQUERY . $key . '/' . $filename) . "\n"; } } if ($this->EE->input->get('use_live_url') == 'y') { $output .= $this->_url_title_js(); } $this->EE->load->helper('smiley'); $output .= $this->EE->config->item('use_compressed_js') != 'n' ? str_replace(array("\n", "\t"), '', smiley_js('', '', FALSE)) : smiley_js('', '', FALSE); $output .= file_get_contents(PATH_THEMES . 'javascript/' . $type . '/saef.js'); $this->EE->output->out_type = 'cp_asset'; $this->EE->output->set_header("Content-Type: text/javascript"); $this->EE->output->set_header('Content-Length: ' . strlen($output)); $this->EE->output->set_output($output); }
/** * product_edit function. * * @access public * @return void */ function product_edit() { $this->EE->cp->set_breadcrumb($this->base_url . '&method=product', lang('nav_br_products')); // Load Resources Required for custom fields $this->EE->lang->loadfile('content'); $this->EE->load->library('api'); $this->EE->api->instantiate('channel_fields'); $this->EE->api->instantiate('channel_entries'); $this->EE->load->library('filemanager'); $this->EE->load->library('spellcheck'); $this->EE->load->library('file_field'); $this->EE->load->model('channel_model'); $this->EE->load->helper(array('snippets', 'typography', 'spellcheck')); $this->EE->file_field->browser(); $this->EE->cp->get_installed_modules(); // Load channel data $this->_channel_data = $this->_load_channel_data($this->br_channel_id); // Setup the file list for custom fields $this->_setup_file_list(); $this->vars["file_list"] = $this->_file_manager['file_list']; $this->EE->cp->add_js_script(array('ui' => array('datepicker', 'resizable', 'draggable', 'droppable'), 'plugin' => array('markitup', 'toolbox.expose', 'overlay', 'tmpl', 'ee_url_title'), 'file' => array('json2', 'cp/publish', 'cp/publish_tabs'))); // Set the Breadcrumb $this->EE->cp->set_breadcrumb($this->base_url . '&method=product', lang('nav_br_products')); // Lets setup a new product flag. If we are going to edit the product flip // to FALSE so that we can differeniate in certain places when needed. $new_product = TRUE; $product_id = 0; $entry_id = 0; // Get the upload preferences $this->EE->load->model('tools_model'); $this->_get_upload_preferences($this->EE->session->userdata('group_id'), $entry_id); // If we were passed a GET product_id and entry_id then // we are editind if (isset($_GET["product_id"]) && isset($_GET["entry_id"])) { $new_product = FALSE; $product_id = $_GET["product_id"]; $entry_id = $_GET["entry_id"]; } // Custom Channel Fields $this->vars["custom"] = array(); // Setup some helpers $this->vars["spell_enabled"] = TRUE; $this->vars["smileys_enabled"] = isset($this->EE->cp->installed_modules['emoticon']) ? TRUE : FALSE; if ($this->vars["smileys_enabled"]) { $this->EE->load->helper('smiley'); $this->EE->cp->add_to_foot(smiley_js()); } // Glossary Items $this->vars['glossary_items'] = $this->EE->load->ee_view('content/_assets/glossary_items', '', TRUE); // Set the global javascript (Content Publish Method) $this->_set_global_js($entry_id); // Get current data if its an edit $data = array(); if ($new_product == FALSE) { // Get the data for the entry_id $prefix = $this->EE->db->dbprefix; $sql = "SELECT \n\t\t\t\t\t\t\t\t\td.* \n\t\t\t\t\t\t\t\tFROM \n\t\t\t\t\t\t\t\t\t" . $prefix . "br_product_entry p, \n\t\t\t\t\t\t\t\t\t" . $prefix . "channel_data d \n\t\t\t\t\t\t\t\tWHERE \n\t\t\t\t\t\t\t\t\tp.entry_id = d.entry_id \n\t\t\t\t\t\t\t\tAND \n\t\t\t\t\t\t\t\t\tp.product_id = " . $product_id; $qry = $this->EE->db->query($sql); $result = $qry->result_array(); // Data array holds the field data // in field_id_# key => val format $data = $result[0]; } // Get the fields for the channel $fields = $this->EE->api_channel_fields->setup_entry_settings($this->br_channel_id, $data, FALSE); // Build the inputs $fields = $this->_prep_field_wrapper($fields); // Now that we support RTE lets load up the required js. if (version_compare(APP_VER, '2.5', '>=')) { $rte_js = $this->EE->functions->fetch_site_index() . QUERY_MARKER . 'ACT=' . $this->EE->cp->fetch_action_id('Rte', 'get_js') . '&toolset_id=0' . '&cp=y' . '&selector=' . urlencode(".rte"); $this->EE->cp->add_to_foot('<script type="text/javascript" src="' . $rte_js . '"></script>'); $this->EE->cp->add_to_head('<link href="' . $this->EE->config->item('theme_folder_url') . 'cp_themes/default/css/rte.css" rel="stylesheet" media="all" />'); } $i = 0; foreach ($fields as $f) { if (isset($f["field_name"])) { $this->EE->api_channel_fields->set_settings($f["field_type"], $f); $this->EE->api_channel_fields->setup_handler($f["field_id"]); // Either put in existing data or nothing on new product $param[0] = $new_product == FALSE ? $data["field_id_" . $f["field_id"]] : ""; // Hack added to deal with double encoding issue // from rte. Yuck but what can you do? - dpd $param[0] = form_prep($param[0], "field_id_" . $f["field_id"]); $this->vars["custom"][$i] = array('settings' => $f, 'display_field' => $this->EE->api_channel_fields->apply('display_field', $param)); $i++; } } if ($new_product == FALSE) { $this->vars['cp_page_title'] = lang('br_product_edit') . ' [' . $product_id . ']'; } else { $this->vars['cp_page_title'] = lang('nav_br_products'); } // Generate the list of products based // on the search terms provided. // Get the products if ($new_product == FALSE) { $products = $this->EE->product_model->get_products($product_id, 1); // Since we are now allowing product type changing // we need to set some defaults on the edit form as // well. We should probably match both instances (new/edit) // but lets just get it started to test it out. -dpd if (!isset($products[0]["donation"][0])) { // some defaults for donations $products[0]["donation"][0] = array('min_donation' => 10, 'allow_recurring' => 0); } // We know the type $fields = array(); $values = '<tr>'; if (isset($products[0]["configurable"])) { foreach ($products[0]["configurable"] as $c) { foreach ($c["attribute"] as $val) { $fields[$val["attribute_id"]] = $val["attribute_id"]; // build the configurable attributes into the row $values .= '<td> <input type="hidden" name="config_attr_' . $val["attribute_id"] . '[]" value="' . $val["option_id"] . '" />' . $this->_option_to_label($val["option_id"]) . ' </td>'; } // Basic inputs $values .= ' <td> <input type="text" name="config_sku[]" value="' . $c["sku"] . '" /></td> <td> <input type="text" name="config_qty[]" value="' . $c["qty"] . '" /></td> <td> <select style="display:none" name="config_adjust_type[]">'; $sel = $c["adjust_type"] == 'fixed' ? 'selected="selected"' : ''; $values .= '<option ' . $sel . '>fixed</option>'; $sel = $c["adjust_type"] == 'percent' ? 'selected="selected"' : ''; $values .= '<option ' . $sel . '>percent</option>'; $values .= ' </select> <input type="text" name="config_adjust[]" value="' . $c["adjust"] . '" /></td> <td class="move_config_row"> <img src="' . $this->_theme('images/move.png') . '" /></td> <td> <input type="hidden" name="config_configurable_id[]" value="' . $c["configurable_id"] . '" /> <a href="#" class="config_item_remove"><img src="' . $this->_theme('images/delete.png') . '" alt="' . lang('br_delete') . '" /></a></td> </tr>'; } } // if its configurable if ($products[0]["type_id"] == 3) { $this->vars["config_products"] = $this->_build_configurable_form($fields, $values); } $product_feeds = $this->EE->product_model->get_feed_id_by_product($product_id); if ($products[0]["sale_start"] == '0000-00-00 00:00:00') { $products[0]["sale_start"] = ''; } else { if ($products[0]["sale_start"] != null) { $products[0]["sale_start"] = date("m/d/y", strtotime($products[0]["sale_start"])); } } if ($products[0]["sale_end"] == '0000-00-00 00:00:00') { $products[0]["sale_end"] = ''; } else { if ($products[0]["sale_end"] != null) { $products[0]["sale_end"] = date("m/d/y", strtotime($products[0]["sale_end"])); } } $this->vars['product_feeds'] = $product_feeds; $this->vars['products'] = $products; $this->vars["title"] = $products[0]["title"]; $this->vars["hidden"] = array('site_id' => $this->site_id, 'type_id' => $products[0]["type_id"], 'product_id' => $products[0]["product_id"], 'entry_id' => $entry_id); // Get the available member groups $qry = $this->EE->member_model->get_member_groups(); $groups = array(); foreach ($qry->result_array() as $row) { $groups[] = $row; } $this->vars["groups"] = $groups; if ($this->vars['products'][0]['type_id'] != 3) { $this->vars["config_opts"] = $this->EE->product_model->get_attribute_config(); $this->vars["config_opts_link"] = $this->ajax_url . $this->EE->cp->fetch_action_id('Brilliant_retail_mcp', 'product_configurable_create_options'); } // Experimental! // // This will allow you to switch the product type on the edit // form? -dpd // if ($this->EE->config->item('br_product_edit_type') === TRUE) { $options = '<select id="type_id" name="type_id">'; foreach ($this->vars['product_type'] as $key => $val) { $sel = $products[0]['type_id'] == $key ? 'selected' : ''; $options .= '<option value="' . $key . '" ' . $sel . '>' . $val . '</option>'; } $options .= '</select>'; $this->vars["type"] = $options; $this->vars["sub_type"] = $this->_get_sub_type($this->vars['products'][0]['type_id'], TRUE); } else { $this->vars["type"] = $this->_config['product_type'][$this->vars['products'][0]['type_id']]; $this->vars["sub_type"] = $this->_get_sub_type($this->vars['products'][0]['type_id']); } $this->vars["attrs"] = $this->_product_attrs($this->vars['products'][0]["attribute_set_id"], $this->vars['products'][0]["product_id"]); $this->vars["attribute_sets"] = $this->EE->product_model->get_attribute_sets(); $this->vars['add_attributes'] = $this->ajax_url . $this->EE->cp->fetch_action_id('Brilliant_retail_mcp', 'product_add_atributes'); $this->vars["options"] = $this->_product_options($this->vars['products'][0]["product_id"]); // Get the images $images = $this->EE->product_model->get_product_images($this->vars['products'][0]["product_id"], FALSE); // Remove the large / thumb values unset($images["image_large"]); unset($images["image_large_title"]); unset($images["image_thumb"]); unset($images["image_thumb_title"]); $this->vars["images"] = $images; // Get Categories // First get the categories that // apply to this product $selected = $this->EE->product_model->get_category_list($this->vars['products'][0]["product_id"]); // Get them all $cat = $this->EE->product_model->get_categories(0); // Create a tree $categories = lang('br_no_product_categories'); if (isset($cat[0])) { $categories = $this->_product_category_tree($cat[0], $cat, 0, $selected); } $this->vars["categories"] = $categories; } else { // Build an empty product shell $p = new Product(); $products = $p->createshell(); $this->vars["products"] = $products; $this->vars['product_feeds'] = array(); // Generate the list of products based // on the search terms provided. $this->vars["type_id"] = 0; // Set the type options $options = '<select id="type_id" name="type_id">'; foreach ($this->vars['product_type'] as $key => $val) { $options .= '<option value="' . $key . '">' . $val . '</option>'; } $options .= '</select>'; $this->vars["type"] = $options; // member groups for the price matrix $qry = $this->EE->member_model->get_member_groups(); $groups = array(); foreach ($qry->result_array() as $row) { $groups[] = $row; } $this->vars["groups"] = $groups; // some defaults for configurable products $this->vars["config_opts"] = $this->EE->product_model->get_attribute_config(); $this->vars["config_opts_link"] = $this->ajax_url . $this->EE->cp->fetch_action_id('Brilliant_retail_mcp', 'product_configurable_create_options'); // some defaults for donations $this->vars["products"][0]["donation"][0] = array('min_donation' => 10, 'allow_recurring' => 0); // get the sub_type $this->vars["sub_type"] = $this->_get_sub_type(); // No Attributes by default $this->vars["attribute_sets"] = $this->EE->product_model->get_attribute_sets(); $this->vars['add_attributes'] = $this->ajax_url . $this->EE->cp->fetch_action_id('Brilliant_retail_mcp', 'product_add_atributes'); $this->vars["attrs"] = ''; $this->vars["options"] = array(); $this->vars["images"] = array(); $this->vars['title'] = lang('br_new_product'); $this->vars['hidden'] = array('site_id' => $this->site_id, 'product_id' => 0, 'type_id' => 0); // Get Categories $cat = $this->EE->product_model->get_categories(0); // Create a tree if (isset($cat[0])) { $categories = $this->_product_category_tree($cat[0], $cat, 0); } else { $categories = array(); } $this->vars["categories"] = $categories; } // What editor should we use for the detail field $this->EE->load->library('product_form'); $this->vars["detail_field"] = $this->EE->product_form->select_editor($products[0]["detail"]); $this->_markitup(); $this->vars['feeds'] = $this->EE->feed_model->get_feeds(); $this->vars["tab"]["main"] = $this->_view('product/tabs/main', $this->vars); $this->vars["tab"]["detail"] = $this->_view('product/tabs/detail', $this->vars); // Include the attributes unless they were hidden if ($this->EE->config->item('br_product_hide_attribute') !== TRUE) { $this->vars["tab"]["attributes"] = $this->_view('product/tabs/attributes', $this->vars); } // Include the options unless they were hidden if ($this->EE->config->item('br_product_hide_option') !== TRUE) { $this->vars["tab"]["option"] = $this->_view('product/tabs/option', $this->vars); } // Include the images unless they were hidden if ($this->EE->config->item('br_product_hide_image') !== TRUE) { $this->vars["tab"]["image"] = $this->_view('product/tabs/image', $this->vars); } $this->vars["tab"]["price"] = $this->_view('product/tabs/price', $this->vars); $this->vars["tab"]["sale_price"] = $this->_view('product/tabs/sale_price', $this->vars); $this->vars["tab"]["category"] = $this->_view('product/tabs/category', $this->vars); #$this->vars["tab"]["addon"] = $this->_view('product/tabs/addon', $this->vars); // Include the related products unless they were hidden if ($this->EE->config->item('br_product_hide_related') !== TRUE) { $this->vars["tab"]["related"] = $this->_view('product/tabs/related', $this->vars); } $this->vars["tab"]["seo"] = $this->_view('product/tabs/seo', $this->vars); // Include the product feed unless they were hidden if ($this->EE->config->item('br_product_hide_feed') !== TRUE) { $this->vars["tab"]["feed"] = $this->_view('product/tabs/feed', $this->vars); } // Want to do something to the edit form before we show it to the world? // Added 1.1.5.0 DPD if ($this->EE->extensions->active_hook('br_product_editform_before') === TRUE) { $this->vars = $this->EE->extensions->call('br_product_editform_before', $this->vars); } $this->EE->javascript->compile(); // Set the form action $this->vars["action"] = 'C=addons_modules&M=show_module_cp&module=brilliant_retail&method=product_update'; return $this->_view('product/edit', $this->vars); }
<?php print smiley_js(); ?> <section class="content"> <div class="row"> <div class="col-md-3"> <!-- Profile Image --> <div > <!-- Widget: user widget style 1 --> <div class="box box-widget widget-user-2"> <!-- Add the bg color to the header using any of the bg-* classes --> <div class="widget-user-header <?php echo $this->config->item('site_palette_active'); ?> "> <div class="widget-user-image"> <form name="userpic" class="upload"> <div id="preview" class="upload__preview"></div> <img alt="User Avatar" width="128" src="<?php echo base_url('assets/images/default-male.jpg'); ?> " class="img-circle"> <div class="upload__progress">Uploading…</div> <div class="upload__link hidden"> <a class="upload-link js-fileapi-wrapper"> <span class="upload-link__txt ">UPLOAD</span>