/** * Метод загрузки данных * * @param Sppc_Dashboard_DateRange $range */ protected function loadResults(Sppc_Dashboard_DateRange $range, $sortField = '', $sortDirection = '') { // Подключаем нужный объект $this->CI->load->model('site'); /* @var $sites Site */ $sites = $this->CI->site; if (empty($sortField)) { $sortField = $this->getSortField(); } if (empty($sortDirection)) { $sortDirection = $this->getSortDirection(); } // Формируем колонки $this->addColumn('name', 'Site Name'); $this->addColumn('impressions', 'Impressions', 'numeric', 'desc'); $this->addColumn('clicks', 'Clicks', 'numeric', 'desc'); $this->addColumn('ctr', '% CTR', 'numeric', 'desc'); $this->addColumn('revenue', 'Earnings', 'numeric', 'desc'); // add additional columns from plugins foreach ($this->_hooks as $hookObj) { $columns = $hookObj->addColumns($this); foreach ($columns as $column) { $this->addColumn($column['name'], $column['title'], $column['type'], $column['order']); } } // Получаем данные по фидам $rowsData = $sites->top(null, $sortField, $sortDirection, array('from' => $range->getUnixStartDate(), 'to' => $range->getUnixEndDate())); foreach ($rowsData as $data) { $code = type_to_str($data['id_publisher'], 'textcode'); $rowData = array(limit_str_and_hint($data['name'], 20) . " (<a target='_blank' href='http://{$data['url']}'>{$data['url']}</a>)", type_to_str($data['impressions'], 'integer'), type_to_str($data['clicks'], 'integer'), type_to_str($data['ctr'], 'procent'), type_to_str($data['revenue'], 'money')); // add data for addtional columns from plugins foreach ($this->_hooks as $hookObj) { $rowData = $hookObj->addColumnsData($data, $rowData); } $this->addRow($rowData); } // Устанавливаем title $this->title = sprintf(__('Top Sites (%d)'), count($rowsData)); }
protected function _top_campaigns() { // load hooks $hooks = array(); $pluginsConfig = Zend_Registry::getInstance()->get('pluginsConfig'); if (isset($pluginsConfig->advertiser->dashboard_blocks->top_campaigns)) { foreach ($pluginsConfig->advertiser->dashboard_blocks->top_campaigns as $hookClass) { $hookObj = new $hookClass(); if ($hookObj instanceof Sppc_Advertiser_Dashboard_TopCampaignsInterface) { $hooks[] = $hookObj; } } } // configure table builder $this->table_builder->clear(); $this->table_builder->insert_empty_cells = false; $this->table_builder->init_sort_vars('topcamps', 'spent', 'desc'); // build column map $colIndex = 0; $colMap = array('name' => $colIndex++, 'spent' => $colIndex++, 'clicks' => $colIndex++, 'impressions' => $colIndex++, 'ctr' => $colIndex++); // add additional columns from plugins foreach ($hooks as $hookObj) { $colMap = $hookObj->extendColumnMap($colMap); } $this->table_builder->sorted_column($colMap['name'], 'name', 'Campaign', 'asc'); $this->table_builder->sorted_column($colMap['spent'], 'spent', 'Spent', 'desc'); $this->table_builder->sorted_column($colMap['clicks'], 'clicks', 'Clicks', 'desc'); $this->table_builder->sorted_column($colMap['impressions'], 'impressions', 'Impressions', 'desc'); $this->table_builder->sorted_column($colMap['ctr'], 'ctr', '% CTR', 'desc'); // create additional columns from plugins foreach ($hooks as $hookObj) { $hookObj->createColumns($colMap, $this->table_builder); } $this->table_builder->add_row_attribute(0, 'class', 'th'); $this->table_builder->add_col_attribute($colMap['spent'], 'class', '"w100 right"'); $this->table_builder->add_col_attribute($colMap['clicks'], 'class', '"w100 right"'); $this->table_builder->add_col_attribute($colMap['impressions'], 'class', '"w100 right"'); $this->table_builder->add_col_attribute($colMap['ctr'], 'class', '"w100 right"'); // define styles for addtition columns from plugins foreach ($hooks as $hookObj) { $hookObj->defineColumnStyles($colMap, $this->table_builder); } $this->table_builder->add_attribute('class', '"xTable mb10"'); $this->load->model('campaigns', '', TRUE); $top = $this->campaigns->top($this->user_id, $this->table_builder->sort_field, $this->table_builder->sort_direction, $this->range); $row = 1; foreach ($top as $id_camp => $camp) { $code = type_to_str($id_camp, 'textcode'); $camp['type'] = $this->campaigns->get_type($id_camp); if ($camp['status'] == 'deleted') { $this->table_builder->set_cell_content($row, $colMap['name'], limit_str_and_hint($camp['name'], 20)); } else { $this->table_builder->set_cell_content($row, $colMap['name'], array('name' => limit_str_and_hint($camp['name'], 20), 'href' => $this->site_url . $this->index_page . 'advertiser/manage_ads/campaign/' . $code), 'link'); } $this->table_builder->set_cell_content($row, $colMap['spent'], type_to_str($camp['spent'], 'money')); $this->table_builder->set_cell_content($row, $colMap['clicks'], type_to_str($camp['clicks'], 'integer')); $this->table_builder->set_cell_content($row, $colMap['impressions'], type_to_str($camp['impressions'], 'integer')); $this->table_builder->set_cell_content($row, $colMap['ctr'], type_to_str($camp['ctr'], 'float') . ' %'); // render additional columns from plugins foreach ($hooks as $hookObj) { $hookObj->renderRow($row, $colMap, $camp, $this->table_builder); } $row++; } if (0 == count($top)) { $this->table_builder->insert_empty_cells = false; $this->table_builder->set_cell_content(1, 0, __('Records not found')); $this->table_builder->cell(1, 0)->add_attribute('class', 'nodata'); $this->table_builder->cell(1, 0)->add_attribute('colspan', count($colMap)); } return $this->parser->parse('advertiser/dashboard/top_campaigns.html', array('CAMPAIGNS' => $this->table_builder->get_sort_html(), 'CAMPCOUNT' => count($top)), TRUE); }
/** * функция вызываемая по умолчанию, выводит таблицу кампаний * * @param integer $id_campaign уникальный код кампании, содержащей группы объявлений * @return ничего не возвращает */ public function index($code_campaign) { $this->id_campaign = type_cast($code_campaign, 'textcode'); $this->load->library('form'); $this->load->helper('periods'); $form = array('id' => 'groups', 'name' => 'manadsgroups_form', 'view' => 'advertiser/manage_ads/groups/table.html', 'redirect' => 'advertiser/manage_ads', 'no_errors' => 'true', 'vars' => array('DATEFILTER' => period_html('manadsgroups')), 'fields' => array('filt' => array('id_field_type' => 'string', 'form_field_type' => 'select', 'options' => array('all' => __('all'), 'active' => __('pl_active'), 'paused' => __('pl_paused'))))); data_range_fields($form, 'select', 'alltime'); $html = $this->form->get_form_content('modify', $form, $this->input, $this); $this->load->model('groups'); $this->_actions($this->input->post('manadsgroups_action')); $this->load->library('Table_Builder'); $this->table_builder->clear(); $this->table_builder->insert_empty_cells = true; $this->table_builder->init_sort_vars('manadsgroups', 'id_campaign', 'asc'); $this->load->model('pagination_post'); $this->pagination_post->set_form_name('manadsgroups'); $total_function = 'total'; $total = $this->groups->{$total_function}($this->id_campaign, $this->temporary['manadsgroups_filt'], $this->date_range); $this->pagination_post->set_total_records($total['cnt']); $this->pagination_post->read_variables('manadsgroups', 1, $this->global_variables->get('GroupsPerPage')); $select_function = 'select'; $groups = $this->groups->{$select_function}($this->id_campaign, $this->temporary['manadsgroups_page'], $this->temporary['manadsgroups_per_page'], $this->table_builder->sort_field, $this->table_builder->sort_direction, $this->temporary['manadsgroups_filt'], $this->date_range); $row = 0; //build column map $colIndex = 0; $colMap = array('chkbox' => $colIndex++, 'id' => $colIndex++, 'name' => $colIndex++, 'status' => $colIndex++, 'ads' => $colIndex++, 'siteChannels' => $colIndex++, 'spent' => $colIndex++, 'impressions' => $colIndex++, 'clicks' => $colIndex++, 'ctr' => $colIndex++, 'action' => $colIndex++); // register additional columns from plugins foreach ($this->_hooks as $hookObj) { $colMap = $hookObj->extendColumnMap($colMap); } // create columns $this->table_builder->set_cell_content($row, $colMap['chkbox'], array('name' => 'checkAll', 'extra' => 'onclick="return select_all(\'manadsgroups\', this)"'), 'checkbox'); $this->table_builder->sorted_column($colMap['id'], "id_group", "ID", "asc"); $this->table_builder->sorted_column($colMap['name'], "name", "Group Name", "asc"); $this->table_builder->sorted_column($colMap['status'], "status", "Current Status", "asc"); $this->table_builder->sorted_column($colMap['ads'], "ads", "Ads", "desc"); $col_name = "Sites/Channels"; $this->table_builder->sorted_column($colMap['siteChannels'], "site_channels", $col_name, "desc"); $this->table_builder->set_cell_content($row, $colMap['spent'], __("Spent")); $this->table_builder->set_cell_content($row, $colMap['impressions'], __("Impressions")); $this->table_builder->set_cell_content($row, $colMap['clicks'], __("Clicks")); $this->table_builder->set_cell_content($row, $colMap['ctr'], __("CTR")); $this->table_builder->set_cell_content($row, $colMap['action'], __('Action')); // create additional columns from plugins foreach ($this->_hooks as $hookObj) { $hookObj->createColumns($colMap, $this->table_builder); } $this->table_builder->add_row_attribute($row, 'class', 'th'); //прописывание стилей для ячеек $this->table_builder->add_col_attribute($colMap['chkbox'], 'class', '"chkbox"'); $this->table_builder->add_col_attribute($colMap['id'], 'class', '"w20"'); $this->table_builder->add_col_attribute($colMap['status'], 'class', '"w100 center"'); $this->table_builder->add_col_attribute($colMap['ads'], 'class', '"w50 right"'); $this->table_builder->add_col_attribute($colMap['siteChannels'], 'class', '"w100 right"'); $this->table_builder->add_col_attribute($colMap['spent'], 'class', '"w100 right"'); $this->table_builder->add_col_attribute($colMap['impressions'], 'class', '"w100 right"'); $this->table_builder->add_col_attribute($colMap['clicks'], 'class', '"w50 right"'); $this->table_builder->add_col_attribute($colMap['ctr'], 'class', '"w50 right"'); $this->table_builder->add_col_attribute($colMap['action'], 'class', '"nowrap center"'); // add styles for additional columns from plugins foreach ($this->_hooks as $hookObj) { $hookObj->defineColumnStyles($colMap, $this->table_builder); } $this->table_builder->add_attribute('class', 'xTable'); $clone_icon = __('Edit'); $row++; $page_total = array('ads' => 0, 'sites_channels' => 0, 'spent' => 0, 'impressions' => 0, 'clicks' => 0); // register additional per page statistic fields foreach ($this->_hooks as $hookObj) { $page_total = $hookObj->registerPerPageStatisticFields($page_total); } foreach ($groups as $id_group => $group) { // calculate per page statistic $page_total['ads'] += $group['ads']; $page_total['sites_channels'] += $group['site_channels']; $page_total['spent'] += $group['spent']; $page_total['impressions'] += $group['impressions']; $page_total['clicks'] += $group['clicks']; // calculate per page statistic for additional columns from plugins foreach ($this->_hooks as $hookObj) { $page_total = $hookObj->calculatePerPageStatistic($page_total, $group); } $code = type_to_str($id_group, 'textcode'); // checkbox $this->table_builder->set_cell_content($row, $colMap['chkbox'], array('name' => 'id_groups[]', 'value' => $code, 'extra' => "id=chk{$row} onclick=\"checktr('chk{$row}','tr{$row}')\""), 'checkbox'); // id $this->table_builder->set_cell_content($row, $colMap['id'], $id_group); // name $this->table_builder->set_cell_content($row, $colMap['name'], array('name' => limit_str_and_hint($group['name'], 30), 'href' => "#select_group", 'extra' => "jframe='no' onclick='return top.show_ads(\"{$code}\",\"\");'"), 'link'); // status $this->table_builder->set_cell_content($row, $colMap['status'], __('grp_' . $group['status'])); // ads $this->table_builder->set_cell_content($row, $colMap['ads'], array('name' => type_to_str($group['ads'], 'integer'), 'href' => "#select_ads", 'extra' => "jframe='no' onclick='return top.show_ads(\"{$code}\", \"ads\");'"), 'link'); // site/channels $this->table_builder->set_cell_content($row, $colMap['siteChannels'], array('name' => type_to_str($group['site_channels'], 'integer'), 'href' => "#select_sitechannels", 'extra' => "jframe='no' onclick='return top.show_ads(\"{$code}\", \"channels\");'"), 'link'); // spent $this->table_builder->set_cell_content($row, $colMap['spent'], type_to_str($group['spent'], 'money')); // impressions $this->table_builder->set_cell_content($row, $colMap['impressions'], type_to_str($group['impressions'], 'integer')); // clicks $this->table_builder->set_cell_content($row, $colMap['clicks'], type_to_str($group['clicks'], 'integer')); // ctr $this->table_builder->set_cell_content($row, $colMap['ctr'], type_to_str($group['ctr'], 'procent')); // action $this->table_builder->set_cell_content($row, $colMap['action'], array('name' => $clone_icon, 'href' => "#edit_group", 'extra' => "jframe='no' class='guibutton floatl ico ico-edit' value='{$clone_icon}' title='{$clone_icon}' onclick='top.editGroup(\"{$code_campaign}\",\"{$code}\");'"), 'link'); // render additional columns from plugins foreach ($this->_hooks as $hookObj) { $hookObj->renderRow($row, $colMap, $group, $this->table_builder); } // add id attribute to the table row $this->table_builder->add_row_attribute($row, 'id', "tr{$row}"); $row++; } if (0 == count($groups)) { $this->table_builder->insert_empty_cells = false; $this->table_builder->set_cell_content($row, 0, ' ' . __('Records not found')); $this->table_builder->cell($row, 0)->add_attribute('class', 'nodata'); $this->table_builder->cell($row, 0)->add_attribute('colspan', count($colMap)); } else { // render per page statistic row $this->table_builder->set_cell_content($row, $colMap['name'], __("Page total")); $this->table_builder->set_cell_content($row, $colMap['ads'], type_to_str($page_total['ads'], 'integer')); $this->table_builder->set_cell_content($row, $colMap['siteChannels'], type_to_str($page_total['sites_channels'], 'integer')); $this->table_builder->set_cell_content($row, $colMap['spent'], type_to_str($page_total['spent'], 'money')); $this->table_builder->set_cell_content($row, $colMap['impressions'], type_to_str($page_total['impressions'], 'integer')); $this->table_builder->set_cell_content($row, $colMap['clicks'], type_to_str($page_total['clicks'], 'integer')); $ctr = $page_total['impressions'] ? $page_total['clicks'] / $page_total['impressions'] * 100 : 0; $this->table_builder->set_cell_content($row, $colMap['ctr'], type_to_str($ctr, 'procent')); $this->table_builder->clear_row_attributes($row); $this->table_builder->add_row_attribute($row, 'class', 'pagetotal'); // render per page statistic for additional columns from plugins foreach ($this->_hooks as $hookObj) { $hookObj->renderPageStatisticRow($row, $colMap, $page_total, $this->table_builder); } // render summary statistic row $row++; $this->table_builder->set_cell_content($row, $colMap['name'], __("Total")); $this->table_builder->set_cell_content($row, $colMap['ads'], type_to_str($total['ads'], 'integer')); $this->table_builder->set_cell_content($row, $colMap['siteChannels'], type_to_str($total['site_channels'], 'integer')); $this->table_builder->set_cell_content($row, $colMap['spent'], type_to_str($total['spent'], 'money')); $this->table_builder->set_cell_content($row, $colMap['impressions'], type_to_str($total['impressions'], 'integer')); $this->table_builder->set_cell_content($row, $colMap['clicks'], type_to_str($total['clicks'], 'integer')); $ctr = $total['impressions'] ? $total['clicks'] / $total['impressions'] * 100 : 0; $this->table_builder->set_cell_content($row, $colMap['ctr'], type_to_str($ctr, 'procent')); $this->table_builder->clear_row_attributes($row); $this->table_builder->add_row_attribute($row, 'class', 'alltotal'); // render summary statistic for additional columns from plugins foreach ($this->_hooks as $hookObj) { $hookObj->renderSummaryRow($row, $colMap, $total, $this->table_builder); } } // Устанавливаем возможность выбора колонок $this->table_builder->use_select_columns(); $invariable_columns = array($colMap['id'], $colMap['name'], $colMap['action']); $this->table_builder->set_invariable_columns($invariable_columns); $html = str_replace('<%GROUPS%>', $this->table_builder->get_sort_html(), $html); $html = str_replace('<%PAGINATION%>', $this->pagination_post->create_form(), $html); $buttons = $this->load->view('advertiser/manage_ads/groups/buttons.html', '', TRUE); $buttons = str_replace('<%CAMPAIGN%>', $code_campaign, $buttons); $html = str_replace('<%BUTTONST%>', str_replace('<%ID%>', 'top_', $buttons), $html); $html = str_replace('<%BUTTONSB%>', str_replace('<%ID%>', 'bottom_', $buttons), $html); $html = str_replace('<%COLUMNS%>', $this->table_builder->get_columns_html(), $html); $this->_set_content($html); $this->_display(); }
/** * Отправляет ответ (HTML таблицу) на запрос списка сайтов выбранного канала * Канал указывается в GET-параметре id_channel */ public function get_sites($id_channel, $date_from = null, $date_to = null) { // Add plugins to hook $this->add_plugins('channel_sites'); $message = ''; if (is_null($date_from) || is_null($date_to)) { $fields = period_load('manage_sites_channels', 'select', 'alltime'); $this->date_range = data_range($fields); } else { $this->date_range = array('from' => $date_from, 'to' => $date_to); } $action = $this->input->post('manage_action'); if ($action) { $id_channel = $this->input->post('id_channel'); switch ($action) { case 'pause': $this->pause_channel_sites(); break; case 'resume': $this->resume_channel_sites(); break; case 'delete': $message = $this->delete_channel_sites(); break; } } $this->pagination_post->clear(); $this->pagination_post->set_form_name('manage_sites_channels_site_' . $id_channel); $total_params = array('channel_id_filter' => $id_channel, 'date_filter' => $this->date_range, 'revenue_field' => $this->revenue_field, 'id_entity' => $this->user_id); $total = $this->site->get_count($total_params); $this->pagination_post->set_total_records($total['count']); $this->pagination_post->read_variables('manage_sites_channels_site', 1, 10, FALSE, 'manage_sites_channels_site_' . $id_channel); //настройка параметров разбиения на страницы $pagination = $this->pagination_post->create_form(); $col_index = 0; $col_alias = array('chkboxes' => $col_index++, 'id' => $col_index++, 'url' => $col_index++, 'name' => $col_index++, 'status' => $col_index++, 'impressions' => $col_index++, 'alternative_impressions' => $col_index++, 'clicks' => $col_index++, 'ctr' => $col_index++, 'revenue' => $col_index++, 'action' => $col_index++); // add addtional columns to column map from plugins foreach ($this->_hooks as $hookObj) { $col_alias = $hookObj->extendColumnMap($col_alias); } $this->table_builder->clear(); $this->table_builder->init_sort_vars('manage_sites_channels_site', 'id', 'desc', FALSE, 'manage_sites_channels_site_' . $id_channel); $this->table_builder->sorted_column($col_alias['id'], 'id', 'ID', 'asc'); $this->table_builder->sorted_column($col_alias['name'], 'name', 'Title', 'asc'); $this->table_builder->sorted_column($col_alias['url'], 'url', 'Site URL', 'asc'); $this->table_builder->sorted_column($col_alias['status'], 'status', 'Status', 'asc'); $this->table_builder->sorted_column($col_alias['impressions'], 'impressions', 'Impressions', 'desc'); $this->table_builder->sorted_column($col_alias['alternative_impressions'], 'alternative_impressions', 'Alternative Impressions', 'desc'); $this->table_builder->sorted_column($col_alias['clicks'], 'clicks', 'Clicks', 'desc'); $this->table_builder->sorted_column($col_alias['ctr'], 'ctr', 'CTR', 'desc'); $this->table_builder->sorted_column($col_alias['revenue'], 'revenue', 'Revenue', 'desc'); //$this->table_builder->sorted_column(9,'creation_date','Creation Date','desc'); //добавление ячеек-заголовка $this->table_builder->set_cell_content(0, $col_alias['chkboxes'], array('name' => 'checkAll', 'extra' => 'onclick="return select_all(\'manage_sites_channels_site\', this)"'), 'checkbox'); $this->table_builder->set_cell_content(0, $col_alias['action'], __('Action')); // create additional columns from plugins foreach ($this->_hooks as $hookObj) { $hookObj->createColumns($col_alias, $this->table_builder); } $this->table_builder->cell(0, $col_alias['chkboxes'])->add_attribute('class', 'simpleTitle'); $this->table_builder->cell(0, $col_alias['action'])->add_attribute('class', 'simpleTitle'); //прописывание стилей для ячеек $this->table_builder->add_col_attribute($col_alias['chkboxes'], 'class', '"chkbox"'); $this->table_builder->add_col_attribute($col_alias['id'], 'class', 'w20'); //$this->table_builder->add_col_attribute(3, 'class', 'w150'); //$this->table_builder->add_col_attribute(3, 'class', '"w80 center"'); $this->table_builder->add_col_attribute($col_alias['status'], 'class', 'w80 center'); $this->table_builder->add_col_attribute($col_alias['impressions'], 'class', 'w80 right'); $this->table_builder->add_col_attribute($col_alias['alternative_impressions'], 'class', 'w80 right'); $this->table_builder->add_col_attribute($col_alias['clicks'], 'class', 'w50 right'); $this->table_builder->add_col_attribute($col_alias['ctr'], 'class', 'w50 right'); //$this->table_builder->add_col_attribute(8, 'class', '"w80 right"'); $this->table_builder->add_col_attribute($col_alias['revenue'], 'class', 'w100 center'); $this->table_builder->add_col_attribute($col_alias['action'], 'class', 'nowrap center'); // add styles for additional columns from plugins foreach ($this->_hooks as $hookObj) { $hookObj->defineColumnStyles($col_alias, $this->table_builder); } $this->table_builder->add_row_attribute(0, 'class', 'th'); //установка атрибутов таблицы $this->table_builder->add_attribute('class', 'xTable'); //or set style here $params = array('fields' => 'sites.id_site as id, ' . 'sites.url, site_channels.status, sites.name, SUM(impressions) as impressions, ' . 'SUM(alternative_impressions) as alternative_impressions, SUM(clicks) as clicks, ' . '(SUM(clicks)/SUM(impressions)*100) as ctr, UNIX_TIMESTAMP(sites.creation_date) as ' . 'creation_date, SUM(' . $this->revenue_field . ') as revenue, ' . 'e.id_entity AS pub_entity', 'order_by' => $this->table_builder->sort_field, 'order_direction' => $this->table_builder->sort_direction, 'channel_id_filter' => $id_channel, 'date_filter' => $this->date_range, 'id_entity' => $this->user_id, 'offset' => ($this->pagination_post->get_page() - 1) * $this->pagination_post->get_per_page(), 'limit' => $this->pagination_post->get_per_page()); // Add addtional fields to $params['fields'] foreach ($this->_hooks as $hookObj) { if (method_exists($hookObj, 'extendColumnQueryFields')) { $params = $hookObj->extendColumnQueryFields($params, 'stat_sites_channels'); } } $sites_array = $this->site->get_list($params); //echo $this->db->last_query(); if (is_null($sites_array)) { $sites_array = array(); } //$this->table_builder->add_from_array ($sites_array); $data_rows_conut = sizeof($sites_array); //модификация контента отдельных столбцов (ссылки, чекбоксы) $code_channel = type_to_str($id_channel, 'textcode'); $page_total = array('revenue' => 0, 'impressions' => 0, 'alternative_impressions' => 0, 'clicks' => 0); // register additional per page statistic fields foreach ($this->_hooks as $hookObj) { $page_total = $hookObj->registerPerPageStatisticFields($page_total); } $pub_entity = NULL; for ($i = 0; $i < $data_rows_conut; $i++) { $pub_entity = $sites_array[$i]['pub_entity']; $page_total['impressions'] += $sites_array[$i]['impressions']; $page_total['alternative_impressions'] += $sites_array[$i]['alternative_impressions']; $page_total['clicks'] += $sites_array[$i]['clicks']; $page_total['revenue'] += $sites_array[$i]['revenue']; // calculate per page statistic for additional columns from plugins foreach ($this->_hooks as $hookObj) { $page_total = $hookObj->calculatePerPageStatistic($page_total, $sites_array[$i]); } $code_site = type_to_str($sites_array[$i]['id'], 'textcode'); if ('deleted' == $sites_array[$i]['status']) { $this->table_builder->set_cell_content($i + 1, $col_alias['chkboxes'], ''); $this->table_builder->set_cell_content($i + 1, $col_alias['action'], ''); $this->table_builder->add_row_attribute($i + 1, 'class', 'deleted_row'); } else { if ($sites_array[$i]['pub_entity'] == $this->user_id) { $this->table_builder->set_cell_content($i + 1, $col_alias['chkboxes'], array('name' => 'id_site[]', 'value' => $sites_array[$i]['id'], 'extra' => 'id=chk' . $i . ' onclick="checktr(\'chk' . $i . '\',\'tr' . ($i + 1) . '\')"'), 'checkbox'); $this->table_builder->set_cell_content($i + 1, $col_alias['action'], array('name' => __('Edit'), 'href' => $this->site_url . $this->index_page . $this->role . '/edit_site/index/' . $sites_array[$i]['id'], 'extra' => 'jframe="no" class="guibutton floatl ico ico-edit" value="{@Edit@}" title="{@Edit@}" onclick="top.location=\'' . $this->site_url . $this->index_page . $this->role . '/edit_site/index/' . $sites_array[$i]['id'] . '\'" target="_top"'), 'link'); $this->table_builder->cell($i + 1, $col_alias['action'])->add_content(array('name' => __('Get code'), 'href' => '#get_code', 'extra' => 'jframe="no" class="guibutton floatl ico ico-puzzle2" value="{@Get code@}" title="{@Get code@}" onclick="top.get_channel_code(\'' . $sites_array[$i]['id'] . '\',\'' . $id_channel . '\')"'), 'link', ' '); $this->table_builder->cell($i + 1, $col_alias['action'])->add_content(array('name' => __('Layout'), 'href' => $this->site_url . $this->index_page . $this->role . '/edit_site_channel_layout/index/' . $sites_array[$i]['id'], 'extra' => 'jframe="no" class="guibutton floatl ico ico-site-layout" value="{@Layout@}" title="{@Layout@}" onclick="top.location=\'' . $this->site_url . $this->index_page . $this->role . '/edit_site_channel_layout/index/' . $sites_array[$i]['id'] . '\'" target="_top"'), 'link', ''); } else { $this->table_builder->set_cell_content($i + 1, $col_alias['chkboxes'], ''); $this->table_builder->set_cell_content($i + 1, $col_alias['action'], ''); } $this->table_builder->cell($i + 1, $col_alias['action'])->add_content(array('name' => __('View Ads'), 'href' => '#view_ads', 'extra' => 'jframe="no" class="guibutton floatl ico ico-viewads" value="' . __("View Ads") . '" title="' . __("View Ads") . '" onclick="top.view_ads(\'' . $code_site . '\',\'' . $code_channel . '\')"'), 'link', ' '); $this->table_builder->add_row_attribute($i + 1, 'id', 'tr' . ($i + 1)); if ('paused' == $sites_array[$i]['status']) { $this->table_builder->add_row_attribute($i + 1, 'class', 'blocked_row'); } } $this->table_builder->set_cell_content($i + 1, $col_alias['id'], $sites_array[$i]['id']); $this->table_builder->set_cell_content($i + 1, $col_alias['name'], limit_str_and_hint($sites_array[$i]['name'], 30)); $this->table_builder->set_cell_content($i + 1, $col_alias['url'], array('name' => $sites_array[$i]['url'], 'href' => 'http://' . $sites_array[$i]['url'], 'extra' => 'target="_blank"'), 'link'); $this->table_builder->set_cell_content($i + 1, $col_alias['status'], __('site_' . $sites_array[$i]['status'])); $this->table_builder->set_cell_content($i + 1, $col_alias['impressions'], type_to_str($sites_array[$i]['impressions'], 'integer')); $this->table_builder->set_cell_content($i + 1, $col_alias['alternative_impressions'], type_to_str($sites_array[$i]['alternative_impressions'], 'integer')); $this->table_builder->set_cell_content($i + 1, $col_alias['clicks'], type_to_str($sites_array[$i]['clicks'], 'integer')); $this->table_builder->set_cell_content($i + 1, $col_alias['ctr'], type_to_str($sites_array[$i]['ctr'], 'float') . ' %'); $this->table_builder->set_cell_content($i + 1, $col_alias['revenue'], type_to_str($sites_array[$i]['revenue'], 'money')); //$this->table_builder->set_cell_content ( $i + 1, 9, type_to_str($sites_array [$i]['creation_date'], 'date')); // render additional columns from plugins foreach ($this->_hooks as $hookObj) { $hookObj->renderRow($i + 1, $col_alias, $sites_array[$i], $this->table_builder); } } //end модификация контента отдельных столбцов (ссылки, чекбоксы) if (0 == $data_rows_conut) { $this->table_builder->insert_empty_cells = false; $this->table_builder->set_cell_content(1, 0, __('Records not found')); $this->table_builder->cell(1, 0)->add_attribute('colspan', count($col_alias)); $this->table_builder->cell(1, 0)->add_attribute('class', 'nodata'); $this->table_builder->remove_col_attribute_value(0, 'class', 'chkbox'); $this->table_builder->cell(0, 0)->add_attribute('class', 'chkbox'); } else { $row = $data_rows_conut + 1; $this->table_builder->set_cell_content($row, $col_alias['name'], __("Page total")); //$this->table_builder->cell($row, 2)->add_attribute('colspan', 2); $this->table_builder->set_cell_content($row, $col_alias['impressions'], type_to_str($page_total['impressions'], 'integer')); $this->table_builder->set_cell_content($row, $col_alias['alternative_impressions'], type_to_str($page_total['alternative_impressions'], 'integer')); $this->table_builder->set_cell_content($row, $col_alias['clicks'], type_to_str($page_total['clicks'], 'integer')); $this->table_builder->set_cell_content($row, $col_alias['revenue'], type_to_str($page_total['revenue'], 'money')); $ctr = $page_total['impressions'] ? $page_total['clicks'] / $page_total['impressions'] * 100 : 0; $this->table_builder->set_cell_content($row, $col_alias['ctr'], type_to_str($ctr, 'procent')); $this->table_builder->clear_row_attributes($row); $this->table_builder->add_row_attribute($row, 'class', 'pagetotal'); // render per page statistic for additional columns from plugins foreach ($this->_hooks as $hookObj) { $hookObj->renderPageStatisticRow($row, $col_alias, $page_total, $this->table_builder); } $row++; $this->table_builder->set_cell_content($row, $col_alias['name'], __("Total")); //$this->table_builder->cell($row, 2)->add_attribute('colspan', 2); $this->table_builder->set_cell_content($row, $col_alias['impressions'], type_to_str($total['impressions'], 'integer')); $this->table_builder->set_cell_content($row, $col_alias['alternative_impressions'], type_to_str($total['alternative_impressions'], 'integer')); $this->table_builder->set_cell_content($row, $col_alias['clicks'], type_to_str($total['clicks'], 'integer')); $this->table_builder->set_cell_content($row, $col_alias['revenue'], type_to_str($total['revenue'], 'money')); $ctr = $total['impressions'] ? $total['clicks'] / $total['impressions'] * 100 : 0; $this->table_builder->set_cell_content($row, $col_alias['ctr'], type_to_str($ctr, 'procent')); $this->table_builder->clear_row_attributes($row); $this->table_builder->add_row_attribute($row, 'class', 'alltotal'); // render summary statistic for additional columns from plugins foreach ($this->_hooks as $hookObj) { $hookObj->renderSummaryRow($row, $col_alias, $total, $this->table_builder); } } // Устанавливаем возможность выбора колонок $this->table_builder->use_select_columns(); $invariable_columns = array($col_alias['chkboxes'], $col_alias['id'], $col_alias['url'], $col_alias['action']); $this->table_builder->set_invariable_columns($invariable_columns); //$this->table_builder->add_attribute ( 'class', 'xTable' ); //or set style here $table = $this->table_builder->get_sort_html(); $content = $this->parser->parse($this->views_paths['iframe_sites_list'], array('MESSAGE' => json_encode(array('message' => __($message))), 'SITES_TABLE' => $table, 'COLUMNS' => $this->table_builder->get_columns_html(), 'PAGINATION' => $pagination, 'ID_CHANNEL' => $id_channel, 'JFRAME_ACTION' => '<%SITEURL%><%INDEXPAGE%>' . $this->role . '/manage_sites_channels/get_sites/' . $id_channel . '/' . $date_from . '/' . $date_to . '/all'), TRUE); if ($pub_entity != $this->user_id) { $content = preg_replace("/\\<a name=\"chan_buttons_begin\"\\>\\<\\/a\\>[\\s\\S]*?\\<a name=\"chan_buttons_end\"\\>\\<\\/a\\>/", '', $content); } //$this->template = "common/parent/iframe.html"; $this->template = "common/parent/jq_iframe.html"; $this->_set_content($content); $this->_display(); }
/** * Search sites according to specified criteria * * @return void */ public function search_sites() { //load nessesary components $this->load->model('pagination_post'); $filter_mode = $this->input->post('filter_mode'); $this->load->helper('periods_helper'); $siteModel = new Sppc_SiteModel(); //initialize table builder $this->table_builder->clear(); $this->table_builder->init_sort_vars('search_sites_cpc', 'url', 'asc'); $col_index = 0; $col_alias = array('url' => $col_index++, 'impressions' => $col_index++, 'clicks' => $col_index++, 'min_bid' => $col_index++, 'min_bid_image' => $col_index++, 'action' => $col_index++); $this->table_builder->sorted_column($col_alias['url'], 'url', "Site", 'asc'); $this->table_builder->sorted_column($col_alias['impressions'], 'impressions', "Monthly Traffic Volume", 'asc'); $this->table_builder->sorted_column($col_alias['clicks'], 'clicks', "Clicks", 'asc'); $this->table_builder->sorted_column($col_alias['min_bid'], 'min_cpc', "Min Bid Text", 'asc'); $this->table_builder->sorted_column($col_alias['min_bid_image'], 'min_cpc_image', "Min Bid Image", 'asc'); $this->table_builder->set_cell_content(0, $col_alias['action'], __('Action')); $this->table_builder->cell(0, $col_alias['action'])->add_attribute('class', 'simpleTitle'); // set table attributes $this->table_builder->add_attribute('class', 'xTable'); //or set style here $this->table_builder->add_row_attribute(0, 'class', 'th f9px'); $this->table_builder->add_col_attribute($col_alias['action'], 'class', 'center'); $this->table_builder->insert_empty_cells = false; // initialize page browser $this->pagination_post->clear(); $this->pagination_post->set_form_name('search_sites_cpc'); //initialize from config $form_data = array("name" => "search_sites_cpc_form", "view" => "advertiser/manage_ads/campaigns/creation/select_sites/jframe_search_sites.html", "action" => $this->site_url . $this->index_page . "advertiser/create_campaign_step_select_sites/search_sites", 'fields' => array('filter_mode' => array('id_field_type' => 'string', 'form_field_type' => 'hidden', 'default' => $filter_mode))); //initialize search filter object $dateRange = data_range(array('mode' => 'select', 'period' => 'lastmonth')); $statStartDate = new Zend_Date($dateRange['from'], Zend_Date::TIMESTAMP); $statEndDate = new Zend_Date($dateRange['to'], Zend_Date::TIMESTAMP); $searchFilter = new Sppc_Site_SearchFilter(); $searchFilter->setConnectToStats(true, $statStartDate, $statEndDate)->setHasCpc(true); // according to filter mode configure search filter object switch ($filter_mode) { case 'all': //show all active sites break; case 'by_category': // search sites by category $categories = array(); $id_category = $this->input->post('id_category'); $include_subcats = $this->input->post('include_subcats'); if ($id_category) { $categoryModel = new Sppc_CategoryModel(); $category = $categoryModel->findObjectById($id_category); if (!is_null($category)) { $categories[] = $category; if ($include_subcats == 'true') { $categories = array_merge($categories, $category->getChildCategories(true)); } } $this->table_builder->insert_empty_cells = false; $form_data['fields']['id_category'] = array('id_field_type' => 'int', 'form_field_type' => 'hidden', 'default' => $id_category); $form_data['fields']['include_subcats'] = array('id_field_type' => 'string', 'form_field_type' => 'hidden', 'default' => $include_subcats); } $searchFilter->setCategories($categories); break; case 'by_name': // search sites by id $siteIds = array(); $id_site = $this->input->post('id_site'); if ($id_site) { $form_data['fields']['id_site'] = array('id_field_type' => 'string', 'form_field_type' => 'hidden', 'default' => $id_site); $id_site = explode(',', $id_site); foreach ($id_site as $site) { $siteIds[] = type_cast($site, 'textcode'); } } $searchFilter->setSiteId($siteIds); break; case 'by_price': // search sites by bid $bid = $this->input->post('price'); $cpcBidType = $this->input->post('cpc_bid_type'); $cpcBidType = in_array($cpcBidType, array('text', 'image')) ? $cpcBidType : false; if ($bid && $cpcBidType) { $form_data['fields']['price'] = array('id_field_type' => 'positive_float', 'form_field_type' => 'hidden', 'default' => type_to_str($bid, 'float')); $form_data['field']['cpc_bid_type'] = array('id_field_type' => 'string', 'form_field_type' => 'hidden', 'default' => $cpcBidType); switch ($cpcBidType) { case 'text': $searchFilter->setMaximumTextBid($bid); break; case 'image': $searchFilter->setMaximumImageBid($bid); break; } } break; } $sitesCount = $siteModel->getCount($searchFilter); $this->pagination_post->set_total_records($sitesCount); $this->pagination_post->read_variables('search_sites_cpc', 1, 10); $sites = $siteModel->search($searchFilter, $this->table_builder->sort_field . ' ' . $this->table_builder->sort_direction, $this->pagination_post->get_per_page(), $this->pagination_post->get_page()); $rowsCount = count($sites); if ($rowsCount > 0) { $rowCounter = 1; foreach ($sites as $site) { // url $this->table_builder->set_cell_content($rowCounter, $col_alias['url'], array('name' => $site->getUrl(), 'href' => 'http://' . $site->getUrl(), 'extra' => 'target="_blank"'), 'link'); $this->table_builder->add_cell_content($rowCounter, $col_alias['url'], '<br>' . limit_str_and_hint($site->getName(), 30)); // last month traffic $this->table_builder->set_cell_content($rowCounter, $col_alias['impressions'], type_to_str($site->getImpressions(), 'impressions')); // Clicks $this->table_builder->set_cell_content($rowCounter, $col_alias['clicks'], type_to_str($site->getClicks(), 'clicks')); // Min bid for text ads $cellContent = ' <span class="min_bid_text">' . type_to_str($site->getMinCpc(), 'money') . ' <span class="hide min_bid_value">' . type_to_str($site->getMinCpc(), 'float') . '</span> </span>'; $this->table_builder->set_cell_content($rowCounter, $col_alias['min_bid'], $cellContent); // Min bid for image ads $cellContent = ' <span class="min_image_bid_text">' . type_to_str($site->getMinCpcImage(), 'money') . ' <span class="hide min_image_bid_value">' . type_to_str($site->getMinCpcImage(), 'float') . ' </span> </span>'; $this->table_builder->set_cell_content($rowCounter, $col_alias['min_bid_image'], $cellContent); // Actions $this->table_builder->set_cell_content($rowCounter, $col_alias['action'], array('name' => __('Add'), 'href' => '#', 'extra' => 'value="{@Add@}" title="{@Add@}" class="guibutton floatl ico ico-plusgreen" jframe="no" onclick="return addSiteToGroup(\'' . type_to_str($site->getId(), 'textcode') . '\');"'), 'link'); // add attribute for row $this->table_builder->add_row_attribute($rowCounter, 'id_site', type_to_str($site->getId(), 'textcode')); $rowCounter++; } } else { $this->table_builder->set_cell_content(1, 0, __('Records not found')); $this->table_builder->cell(1, 0)->add_attribute('colspan', count($col_alias)); $this->table_builder->cell(1, 0)->add_attribute('class', 'nodata'); } // Устанавливаем возможность выбора колонок $this->table_builder->use_select_columns(); $invariable_columns = array($col_alias['url'], $col_alias['action']); $this->table_builder->set_invariable_columns($invariable_columns); $sites_table = $this->table_builder->get_sort_html(); $this->template = "common/parent/jq_iframe.html"; $form_content = $this->form->get_form_content('create', $form_data, $this->input, $this); $form_content = str_replace('<%SITES_TABLE%>', $sites_table, $form_content); $form_content = str_replace('<%COLUMNS%>', $this->table_builder->get_columns_html(), $form_content); $form_content = str_replace('<%PAGINATION%>', $this->pagination_post->create_form(), $form_content); $this->_set_content($form_content); $this->_display(); }
/** * Show table with selected sites * * @return string */ public function channels() { $this->load->library('form'); $this->load->helper('periods'); $form = array('id' => 'channels', 'name' => 'manadschannels_form', 'view' => 'advertiser/manage_ads/ads/channels.html', 'redirect' => 'advertiser/manage_ads', 'no_errors' => 'true', 'action' => $this->site_url . $this->index_page . "advertiser/manage_ads_ads/index/" . type_to_str($this->id_group, 'textcode'), 'vars' => array('DATEFILTER' => period_html('manadschannels')), 'fields' => array('filt' => array('id_field_type' => 'string', 'form_field_type' => 'select', 'options' => array('all' => __('all'), 'active' => __('pl_active'), 'non-active' => __('pl_non-active'), 'completed' => __('pl_completed'), 'paused' => __('pl_paused'))))); data_range_fields($form, 'select', 'alltime'); $html = $this->form->get_form_content('modify', $form, $this->input, $this); $this->load->model("site", "", TRUE); $this->load->model('sites_channels'); $this->model = $this->sites_channels; $this->_actions_channels($this->input->post('manadschannels_action')); $this->load->library('Table_Builder'); $this->table_builder->clear(); $this->table_builder->insert_empty_cells = true; $this->table_builder->init_sort_vars('manadschannels', 'id_site_channel', 'asc', FALSE, NULL, $this->id_campaign_type); $this->load->model('pagination_post'); $this->pagination_post->set_form_name('manadschannels'); $total = $this->sites_channels->total($this->id_group, $this->temporary['manadschannels_filt'], $this->date_range); $this->pagination_post->set_total_records($total['cnt']); $this->pagination_post->read_variables('manadschannels', 1, $this->global_variables->get('ChannelsPerPage', 0, 10)); $channels = $this->sites_channels->select($this->user_id, $this->id_group, $this->temporary['manadschannels_page'], $this->temporary['manadschannels_per_page'], $this->table_builder->sort_field, $this->table_builder->sort_direction, $this->temporary['manadschannels_filt'], $this->date_range); $row = 0; // build column map $colIndex = 0; $colMap = array('chkbox' => $colIndex++, 'id' => $colIndex++, 'site' => $colIndex++, 'channel' => $colIndex++, 'status' => $colIndex++, 'program' => $colIndex++, 'price' => $colIndex++, 'format' => $colIndex++, 'spent' => $colIndex++, 'impressions' => $colIndex++, 'clicks' => $colIndex++, 'ctr' => $colIndex++); // create columns $this->table_builder->set_cell_content(0, $colMap['chkbox'], array('name' => 'checkAll', 'extra' => 'onclick="return select_all(\'manadsads\', this)"'), 'checkbox'); $this->table_builder->sorted_column($colMap['id'], "id_site_channel", "ID", "asc"); $this->table_builder->sorted_column($colMap['site'], "site_name", "Site", "asc"); $this->table_builder->sorted_column($colMap['channel'], "name", "Channel", "asc"); $this->table_builder->sorted_column($colMap['status'], "tstatus", "Current Status", "asc"); $this->table_builder->sorted_column($colMap['program'], "program_type", "Cost Model", "asc"); $this->table_builder->set_cell_content($row, $colMap['price'], __("Price")); $this->table_builder->sorted_column($colMap['format'], "ad_type", "Format", "asc"); $this->table_builder->sorted_column($colMap['spent'], "spent", "Spent", "desc"); $this->table_builder->sorted_column($colMap['impressions'], "impressions", "Impressions", "desc"); $this->table_builder->sorted_column($colMap['clicks'], "clicks", "Clicks", "desc"); $this->table_builder->sorted_column($colMap['ctr'], "ctr", "CTR", "desc"); // setup columns styles $this->table_builder->add_col_attribute($colMap['chkbox'], 'class', '"chkbox"'); $this->table_builder->add_col_attribute($colMap['id'], 'class', '"w20"'); $this->table_builder->add_col_attribute($colMap['channel'], 'class', '"w100 center"'); $this->table_builder->add_col_attribute($colMap['status'], 'class', '"center"'); $this->table_builder->add_col_attribute($colMap['program'], 'class', '"w100 center"'); $this->table_builder->add_col_attribute($colMap['price'], 'class', '"w100 center"'); $this->table_builder->add_col_attribute($colMap['format'], 'class', '"w50 center"'); $this->table_builder->add_col_attribute($colMap['spent'], 'class', '"right"'); $this->table_builder->add_col_attribute($colMap['impressions'], 'class', '"right"'); $this->table_builder->add_col_attribute($colMap['clicks'], 'class', '"right"'); $this->table_builder->add_col_attribute($colMap['ctr'], 'class', '"right"'); $this->table_builder->add_row_attribute($row, 'class', 'th'); $this->table_builder->add_attribute('class', 'xTable'); $row++; $page_total = array('spent' => 0, 'impressions' => 0, 'clicks' => 0); //render table rows foreach ($channels as $id_channel => $channel) { $page_total['spent'] += $channel['spent']; $page_total['impressions'] += $channel['impressions']; $page_total['clicks'] += $channel['clicks']; $code = type_to_str($id_channel, 'textcode'); // checkbox $this->table_builder->set_cell_content($row, $colMap['chkbox'], array('name' => 'id_channels[]', 'value' => $code, 'extra' => "id=chk{$row} onclick=\"checktr('chk{$row}','tr{$row}')\""), 'checkbox'); // id $this->table_builder->set_cell_content($row, $colMap['id'], $id_channel); // site $this->table_builder->set_cell_content($row, $colMap['site'], array('name' => limit_str_and_hint($channel['site_name'], 30), 'href' => 'http://' . $channel['url'], 'extra' => "target=blank"), 'link'); $this->table_builder->cell($row, $colMap['site'])->add_attribute('class', 'td_site'); // channel $this->table_builder->set_cell_content($row, $colMap['channel'], limit_str_and_hint($channel['name'], 30)); // status $this->table_builder->set_cell_content($row, $colMap['status'], __('chn_' . $channel['status'])); $this->table_builder->cell($row, $colMap['status'])->add_attribute('class', "td_status"); // program $this->table_builder->set_cell_content($row, $colMap['program'], __($channel['type'])); // price $allowedTypes = explode(',', $channel['format']); if (in_array(Sppc_Channel::AD_TYPE_IMAGE, $allowedTypes)) { $cost = $channel['cost_image']; } else { if (in_array(Sppc_Channel::AD_TYPE_TEXT, $allowedTypes)) { $cost = $channel['cost_text']; } else { $cost = 0; } } $cost = type_to_str($cost, 'money'); switch ($channel['type']) { case 'CPM': $cost = "{$cost} / {$channel['volume']} " . __('impressions'); break; case 'Flat_Rate': $cost = "{$cost} / {$channel['volume']} " . __('days'); break; } $this->table_builder->set_cell_content($row, $colMap['price'], $cost); // format $this->table_builder->set_cell_content($row, $colMap['format'], ''); if (in_array(Sppc_Channel::AD_TYPE_TEXT, $allowedTypes)) { $ico_path = $this->site_url . 'images/smartppc6/icons/script_code.png'; $hint_title = __('Text Ad') . ' (' . $channel['width'] . '×' . $channel['height'] . ')'; $img_prefix = 'txt_'; $this->table_builder->cell($row, $colMap['format'])->add_content(array('src' => $ico_path, 'extra' => 'title="' . $hint_title . '" href="' . $this->site_url . 'images/dimensions_preview/' . $img_prefix . $channel['id_dimension'] . '.png" class="tooltip"'), 'image'); } if (in_array(Sppc_Channel::AD_TYPE_IMAGE, $allowedTypes)) { $ico_path = $this->site_url . 'images/smartppc6/icons/image.png'; $hint_title = __('Image Ad') . ' (' . $channel['width'] . '×' . $channel['height'] . ')'; $img_prefix = 'img_'; $this->table_builder->cell($row, $colMap['format'])->add_content(array('src' => $ico_path, 'extra' => 'title="' . $hint_title . '" href="' . $this->site_url . 'images/dimensions_preview/' . $img_prefix . $channel['id_dimension'] . '.png" class="tooltip"'), 'image'); } $this->table_builder->cell($row, $colMap['format'])->add_content('<br>' . $channel['width'] . '×' . $channel['height']); // spent $this->table_builder->set_cell_content($row, $colMap['spent'], type_to_str($channel['spent'], 'money')); // impressions $this->table_builder->set_cell_content($row, $colMap['impressions'], type_to_str($channel['impressions'], 'integer')); // clicks $this->table_builder->set_cell_content($row, $colMap['clicks'], type_to_str($channel['clicks'], 'integer')); // ctr $this->table_builder->set_cell_content($row, $colMap['ctr'], type_to_str($channel['ctr'], 'procent')); // add attributes to the table row $this->table_builder->add_row_attribute($row, 'id', "tr_{$code}"); if ($channel['status'] == 'paused') { $this->table_builder->add_row_attribute($row, 'class', 'blocked_row'); } $row++; } if (0 == count($channels)) { $this->table_builder->insert_empty_cells = FALSE; $this->table_builder->set_cell_content($row, 0, __('Records not found')); $this->table_builder->cell($row, 0)->add_attribute('colspan', count($colMap)); } else { // add page summary row $this->table_builder->set_cell_content($row, $colMap['chkbox'], ''); $this->table_builder->set_cell_content($row, $colMap['id'], ''); $this->table_builder->set_cell_content($row, $colMap['site'], __("Page total")); $this->table_builder->set_cell_content($row, $colMap['spent'], type_to_str($page_total['spent'], 'money')); $this->table_builder->set_cell_content($row, $colMap['impressions'], type_to_str($page_total['impressions'], 'integer')); $this->table_builder->set_cell_content($row, $colMap['clicks'], type_to_str($page_total['clicks'], 'integer')); $ctr = $page_total['impressions'] ? $page_total['clicks'] / $page_total['impressions'] * 100 : 0; $this->table_builder->set_cell_content($row, $colMap['ctr'], type_to_str($ctr, 'procent')); $this->table_builder->clear_row_attributes($row); $this->table_builder->add_row_attribute($row, 'class', 'pagetotal'); // add summary row $row++; $this->table_builder->set_cell_content($row, $colMap['site'], __("Total")); $this->table_builder->set_cell_content($row, $colMap['spent'], type_to_str($total['spent'], 'money')); $this->table_builder->set_cell_content($row, $colMap['impressions'], type_to_str($total['impressions'], 'integer')); $this->table_builder->set_cell_content($row, $colMap['clicks'], type_to_str($total['clicks'], 'integer')); $ctr = $total['impressions'] ? $total['clicks'] / $total['impressions'] * 100 : 0; $this->table_builder->set_cell_content($row, $colMap['ctr'], type_to_str($ctr, 'procent')); $this->table_builder->clear_row_attributes($row); $this->table_builder->add_row_attribute($row, 'class', 'alltotal'); } // Устанавливаем возможность выбора колонок $this->table_builder->use_select_columns(); $invariable_columns = array($colMap['id'], $colMap['site'], $colMap['channel']); $this->table_builder->set_invariable_columns($invariable_columns); $html = str_replace('<%CHANNELS%>', $this->table_builder->get_sort_html(), $html); $html = str_replace('<%PAGINATION%>', $this->pagination_post->create_form(), $html); $vars = array('EDITNAME' => __('Manage Channels'), 'EDITFUNCTION' => 'editChannels', 'TAB' => 'channels'); $buttons = ""; $buttons .= $this->parser->parse('advertiser/manage_ads/ads/channels_buttons.html', $vars, TRUE); $buttons = str_replace('<%GROUP%>', "'" . type_to_str($this->id_group, 'textcode') . "'", $buttons); $html = str_replace('<%BUTTONST%>', str_replace('<%ID%>', 'top_', $buttons), $html); $html = str_replace('<%BUTTONSB%>', str_replace('<%ID%>', 'bottom_', $buttons), $html); $html = str_replace('<%COLUMNS%>', $this->table_builder->get_columns_html(), $html); return $html; }
protected function sites_table($sitecode = null) { $this->load->library('Table_Builder'); $this->table_builder->clear(); $this->table_builder->insert_empty_cells = false; $this->table_builder->init_sort_vars('site_directory', 'name', 'asc'); $this->load->model('pagination_post'); $this->pagination_post->set_form_name('site_directory'); $this->load->model('site'); $this->pagination_post->set_total_records($this->site->directory_total($this->ad_type_filter, $this->image_size_filter, $this->cost_model_filter, $this->category_filter, $this->keyword_filter)); $siteInfo = null; if (!is_null($sitecode)) { $this->load->helper('fields'); $siteId = type_cast($sitecode, 'textcode'); $siteInfo = $this->site->get_info($siteId); if (!is_null($siteInfo)) { $currentSitePosition = $this->site->directory_total($this->ad_type_filter, $this->image_size_filter, $this->cost_model_filter, $this->category_filter, $this->keyword_filter, $siteInfo->name); } } if (is_null($siteInfo)) { $this->pagination_post->read_variables('site_directory', 1, $this->global_variables->get('SiteDirectoryPerPage')); $records = $this->site->directory_select($this->temporary['site_directory_page'], $this->temporary['site_directory_per_page'], $this->table_builder->sort_field, $this->table_builder->sort_direction, $this->ad_type_filter, $this->image_size_filter, $this->cost_model_filter, $this->category_filter, $this->keyword_filter); } else { $sitesPerPage = $this->global_variables->get('SiteDirectoryPerPage'); $currentPage = 1; if ($currentSitePosition > $sitesPerPage) { $currentPage = ceil($currentSitePosition / $sitesPerPage); } $this->pagination_post->read_variables('site_directory', $currentPage, $sitesPerPage, true); $records = $this->site->directory_select($currentPage, $sitesPerPage, $this->table_builder->sort_field, $this->table_builder->sort_direction, $this->ad_type_filter, $this->image_size_filter, $this->cost_model_filter, $this->category_filter, $this->keyword_filter); } $this->table_builder->sorted_column(0, "name", __("Site Description"), "asc"); $this->table_builder->set_cell_content(0, 1, __("Channels")); $this->table_builder->set_cell_content(0, 2, __("Cost Models")); $this->table_builder->add_col_attribute(0, 'class', 'nohl cursor-hand'); $this->table_builder->add_col_attribute(1, 'class', 'center w100'); $this->table_builder->add_col_attribute(2, 'class', 'center w100'); $this->table_builder->add_row_attribute(0, 'class', 'th'); $this->table_builder->add_attribute('class', 'xTable w100p'); $description_template = $this->parser->parse('common/site_directory/description.html', array('ROLE' => $this->role)); $row = 1; foreach ($records as $id => $record) { $description = str_replace('<%NAME%>', limit_str_and_hint(type_to_str($record['name'], 'encode'), 20), $description_template); $description = str_replace('<%URL%>', $record['url'], $description); $description = str_replace('<%URLQANCAST%>', implode(".", array_reverse(explode(".", preg_replace('/^.*?\\.([a-zA-Z0-9-]+\\.[a-zA-Z0-9-]+)/si', '$1', $record['url'])))), $description); $site_code = type_to_str($id, 'textcode'); $description = str_replace('<%CODESITE%>', $site_code, $description); $record['description'] = str_replace("\n", '<br>', type_to_str($record['description'], 'encode')); $description = str_replace('<%DESCRIPTION%>', $record['description'], $description); $description = str_replace('<%IMAGE%>', $this->site->get_thumb($id), $description); $this->table_builder->set_cell_content($row, 0, $description); $ch_count = 0; $f_row = $row; $ad_type = array(); $cost_models = array(); if (isset($record['channels'])) { foreach ($record['channels'] as $channel) { $cost_mods = explode(',', $channel['cost_model']); //$cost_models = array(); foreach ($cost_mods as $cost_model) { if (trim($cost_model) != '') { $cost_models[] = __(trim($cost_model)); } } $allowedAdTypes = explode(',', $channel['ad_type']); if (in_array(Sppc_Channel::AD_TYPE_TEXT, $allowedAdTypes)) { $ad_type[] = __('Text'); } if (in_array(Sppc_Channel::AD_TYPE_IMAGE, $allowedAdTypes)) { $ad_type[] = __('Image'); } } } if ($ch_count == 0) { $this->table_builder->set_cell_content($row, 1, implode(', ', array_unique($ad_type))); $this->table_builder->set_cell_content($row, 2, implode(', ', array_unique($cost_models))); } $row++; $this->table_builder->set_cell_content($row, 0, "<a name='{$site_code}'></a><div id='{$site_code}' class='site_info'></div>"); $this->table_builder->cell($row, 0)->add_attribute('colspan', 3); $this->table_builder->cell($row, 0)->add_attribute('style', 'padding-top: 0px; padding-bottom: 0px; height: 0px;'); $row++; } if (0 == count($records)) { $this->table_builder->insert_empty_cells = false; $this->table_builder->set_cell_content(1, 0, __('Records not found')); $this->table_builder->cell(1, 0)->add_attribute('colspan', 3); $this->table_builder->cell(1, 0)->add_attribute('class', 'nodata'); } return array('TABLE' => $this->table_builder->get_sort_html(), 'PAGINATION' => $this->pagination_post->create_form()); }
/** * Получение HTML-таблицы, содержащей каналы, добавленные в группу * */ private function _get_added_channels($status_filter) { $sites_channels_programs = array(); $this->load->model('new_campaign'); $this->new_campaign->init_storage($this->id_xml); //обновление параметров добавленных ранее сайтов-каналов $modified_sites_channels_ids = $this->input->post('modified_sites_channels_info'); $modified_sites_channels_ids = json_decode($modified_sites_channels_ids); if (!is_null($modified_sites_channels_ids)) { $this->load->model('channel_program'); foreach ($modified_sites_channels_ids as $id) { $site_channel_info = $this->new_campaign->get_site_channel_info($id); if (count($site_channel_info) > 0 && 'old' == $site_channel_info['status']) { $cost = $site_channel_info['cost']; $volume = $site_channel_info['volume']; $program_option = $site_channel_info['id_program']; $ad_type = $site_channel_info['ad_type']; } else { //для только что добавленных сайтов-каналов берем инфо о цене и объеме из базы $program_option = $this->input->post('site_channel_' . $id . '_program_option'); $ad_type = $this->input->post('site_channel_' . $id . '_ad_type'); $allowedAdTypes = explode(',', $ad_type); $textAllowed = in_array(Sppc_Channel::AD_TYPE_TEXT, $allowedAdTypes) ? true : false; $imageAllowed = in_array(Sppc_Channel::AD_TYPE_IMAGE, $allowedAdTypes) ? true : false; $program_info = $this->channel_program->get_info($program_option); if (!is_null($program_info)) { $volume = $program_info->volume; if ($textAllowed) { $cost = $program_info->cost_text; } if ($imageAllowed) { $cost = $program_info->cost_image; } } else { continue; // не добавляем cайт-канал с неизвестной ценой } } $this->new_campaign->add_site_channel(array('id_site_channel' => $id, 'cost' => $cost, 'volume' => $volume, 'id_program' => $program_option, 'ad_type' => $ad_type)); } $this->new_campaign->save_data(); } $action = $this->input->post('action'); if ($action) { $id_site_channel = $this->input->post('id_site_channel'); switch ($action) { case 'delete_site_channel': if ($id_site_channel) { $this->new_campaign->del_site_channel($id_site_channel); $this->new_campaign->save_data(); } break; } } $added_sites_channels = $this->new_campaign->get_sites_channels(array('status' => $status_filter)); $added_sites_channels_ids = array_keys($added_sites_channels); $this->table_builder->clear(); if ('old' == $status_filter) { $this->table_builder->init_sort_vars('iframe_added_channels', 'site_name', 'asc'); $delete_js_function = 'deleteSiteChannelFromGroup'; } else { $this->table_builder->init_sort_vars('iframe_recently_added_channels', 'site_name', 'asc'); $delete_js_function = 'deleteRecentSiteChannelFromGroup'; } $this->table_builder->sorted_column(0, 'site_name', "Site Name", 'asc'); $this->table_builder->sorted_column(1, 'channel_name', 'Channel', 'asc'); $this->table_builder->set_cell_content(0, 2, __('Format')); $this->table_builder->set_cell_content(0, 3, __('Ad Type')); $this->table_builder->set_cell_content(0, 4, __('Cost Model')); $this->table_builder->set_cell_content(0, 5, __('Price')); $this->table_builder->sorted_column(7, 'impressions', 'Traffic Volume', 'asc'); $this->table_builder->set_cell_content(0, 8, __('Action')); $this->table_builder->add_row_attribute(0, 'class', 'th'); $this->table_builder->cell(0, 2)->add_attribute('class', 'simpleTitle'); $this->table_builder->cell(0, 4)->add_attribute('class', 'simpleTitle'); $this->table_builder->cell(0, 5)->add_attribute('class', 'simpleTitle'); $this->table_builder->cell(0, 8)->add_attribute('class', 'simpleTitle'); //установка атрибутов таблицы $this->table_builder->add_attribute('class', '"xTable w100p"'); //or set style here $this->table_builder->add_row_attribute(0, 'class', 'th'); $this->table_builder->add_col_attribute(2, 'class', '"w100 center"'); $this->table_builder->add_col_attribute(3, 'class', '"w100 center"'); $this->table_builder->add_col_attribute(4, 'class', '"w100 center"'); $this->table_builder->add_col_attribute(5, 'class', '"w300"'); $this->table_builder->add_col_attribute(7, 'class', '"w100 center"'); $this->table_builder->add_col_attribute(8, 'class', '"nowrap center"'); if (count($added_sites_channels_ids) > 0) { $this->load->helper('periods_helper'); $this->load->model('channel'); $params = array('fields' => 'id_site_channel, channels.ad_type, channels.name as channel_name,' . ' sites.url as site_url, sites.name as site_name, sites.id_site,' . ' channels.id_channel, channels.id_dimension, dimensions.width,' . ' dimensions.height, SUM(impressions) as impressions', 'disable_site_ordering' => true, 'order_by' => $this->table_builder->sort_field, 'order_direction' => $this->table_builder->sort_direction, 'site_channel_id_filter' => $added_sites_channels_ids, 'date_filter' => data_range(array('mode' => 'select', 'period' => 'lastmonth'))); $sites_channels_array = $this->channel->get_sites_channels($params); if (is_null($sites_channels_array)) { $sites_channels_array = array(); } else { //формирование данных о программах, доступных в каждом канале // для новых сайтов-каналов определяем доступные программы $this->load->model('channel_program'); if ('new' == $status_filter) { $this->load->model('sites_channels'); foreach ($sites_channels_array as $site_channel) { $available_programs = $this->channel_program->get_list(array('fields' => 'id_program, title, program_type, cost_text, cost_image, ' . 'volume', 'id_channel' => $site_channel['id_channel'], 'order_by' => 'title', 'order_direction' => 'asc')); if (!is_null($available_programs)) { $slot_info = $this->sites_channels->get_slot_info($site_channel['id_site_channel']); $flat_rate_image_is_allowed = false; if ($slot_info['free'] == 0) { $flat_rate_is_allowed = false; } else { $flat_rate_is_allowed = true; $flat_rate_image_is_allowed = $slot_info['free'] == $slot_info['max']; } foreach ($available_programs as $key => &$available_program) { if ('Flat_Rate' == $available_program['program_type'] && !$flat_rate_is_allowed) { unset($available_programs[$key]); } else { $available_program['cost_per_volume_text'] = type_to_str($available_program['cost_text'], 'money') . ' / ' . type_to_str($available_program['volume'], 'integer') . ' '; $available_program['cost_per_volume_image'] = type_to_str($available_program['cost_image'], 'money') . ' / ' . type_to_str($available_program['volume'], 'integer') . ' '; if ('CPM' == $available_program['program_type']) { $available_program['cost_per_volume_text'] .= __('impressions'); $available_program['cost_per_volume_image'] .= __('impressions'); } else { $available_program['cost_per_volume_text'] .= __('days'); $available_program['cost_per_volume_image'] .= __('days'); } } } $sites_channels_programs[$site_channel['id_site_channel']] = array('programs' => $available_programs, 'restrictions' => array('flat_rate_image_is_allowed' => $flat_rate_image_is_allowed, 'flat_rate_is_allowed' => $flat_rate_is_allowed)); } } } } } else { $sites_channels_array = array(); } $data_rows_conut = sizeof($sites_channels_array); $row_counter = 1; $this->table_builder->insert_empty_cells = false; for ($i = 0; $i < $data_rows_conut; $i++) { $this->table_builder->set_cell_content($row_counter, 0, limit_str_and_hint($sites_channels_array[$i]['site_name'], 30) . ' (<a target="_blank" href="http://' . $sites_channels_array[$i]['site_url'] . '">' . $sites_channels_array[$i]['site_url'] . '</a>)'); $this->table_builder->set_cell_content($row_counter, 1, type_to_str($sites_channels_array[$i]['channel_name'], 'encode')); $allowedTypes = explode(',', $sites_channels_array[$i]['ad_type']); $sites_channels_programs[$sites_channels_array[$i]['id_site_channel']]['allowed'] = $allowedTypes; $sites_channels_programs[$sites_channels_array[$i]['id_site_channel']]['labels'] = array('text' => __('Text'), 'image' => __('Image')); $this->table_builder->set_cell_content($row_counter, 2, ''); $selected_ad_type = $added_sites_channels[$sites_channels_array[$i]['id_site_channel']]['ad_type']; if (in_array(Sppc_Channel::AD_TYPE_TEXT, $allowedTypes)) { $ico_path = $this->site_url . 'images/smartppc6/icons/script_code.png'; $hint_title = __('Text Ad') . ' (' . $sites_channels_array[$i]['width'] . '×' . $sites_channels_array[$i]['height'] . ')'; $img_prefix = 'txt_'; $this->table_builder->cell($row_counter, 2)->add_content(array('src' => $ico_path, 'extra' => 'title="' . $hint_title . '" href="' . $this->site_url . 'images/dimensions_preview/' . $img_prefix . $sites_channels_array[$i]['id_dimension'] . '.png" class="tooltip"'), 'image'); } if (in_array(Sppc_Channel::AD_TYPE_IMAGE, $allowedTypes)) { $ico_path = $this->site_url . 'images/smartppc6/icons/image.png'; $hint_title = __('Image Ad') . ' (' . $sites_channels_array[$i]['width'] . '×' . $sites_channels_array[$i]['height'] . ')'; $img_prefix = 'img_'; $this->table_builder->cell($row_counter, 2)->add_content(array('src' => $ico_path, 'extra' => 'title="' . $hint_title . '" href="' . $this->site_url . 'images/dimensions_preview/' . $img_prefix . $sites_channels_array[$i]['id_dimension'] . '.png" class="tooltip"'), 'image'); } $this->table_builder->cell($row_counter, 2)->add_content($sites_channels_array[$i]['width'] . '×' . $sites_channels_array[$i]['height'], '', '<br/> '); $selected_program_type = $this->channel_program->get_program_type($added_sites_channels[$sites_channels_array[$i]['id_site_channel']]['id_program']); $selected_cost_option = $added_sites_channels[$sites_channels_array[$i]['id_site_channel']]['id_program']; $program_types_options = array(); if ('old' == $status_filter) { $channel_program_types = array($selected_program_type); $program_info = $this->channel_program->get_info($selected_cost_option); if (is_null($program_info)) { $program_cost_options = array($selected_cost_option => array('title' => 'ERROR GETTING PROGRAM INFO', 'volume' => 0, 'cost' => 0)); } else { $cost = $added_sites_channels[$sites_channels_array[$i]['id_site_channel']]['cost']; $volume = $added_sites_channels[$sites_channels_array[$i]['id_site_channel']]['volume']; $program_cost_options = array($selected_cost_option => array('title' => $program_info->title, 'volume' => $volume, 'cost' => $cost)); } } else { $channel_program_types = $this->channel_program->get_channel_program_types($sites_channels_array[$i]['id_channel']); if (!$sites_channels_programs[$sites_channels_array[$i]['id_site_channel']]['restrictions']['flat_rate_is_allowed']) { foreach ($channel_program_types as $key => $program_type) { if ('Flat_Rate' == $program_type) { unset($channel_program_types[$key]); break; } } } else { //Flat Rate на первое место в списке типов программ $flat_rate_index = array_search('Flat_Rate', $channel_program_types); if (FALSE !== $flat_rate_index) { unset($channel_program_types[$flat_rate_index]); array_unshift($channel_program_types, 'Flat_Rate'); } } $program_cost_options = $this->channel_program->get_channel_program_options($sites_channels_array[$i]['id_channel'], $selected_program_type, $selected_ad_type); } foreach ($program_cost_options as &$cost_option) { $cost_option = $cost_option['title'] . ' (' . type_to_str($cost_option['cost'], 'money') . ' / ' . type_to_str($cost_option['volume'], 'integer'); if ('CPM' == $selected_program_type) { $cost_option .= ' ' . __('impressions') . ')'; } else { $cost_option .= ' ' . __('days') . ')'; } } foreach ($channel_program_types as $channel_program_type) { $program_types_options[$channel_program_type] = __($channel_program_type); } $ad_types_options = array(); if (in_array(Sppc_Channel::AD_TYPE_TEXT, $allowedTypes)) { $ad_types_options['text'] = __('Text'); } if (in_array(Sppc_Channel::AD_TYPE_IMAGE, $allowedTypes)) { $keys = array(); $labels = array(); if (in_array(Sppc_Channel::AD_TYPE_TEXT, $allowedTypes)) { $keys[] = 'text'; $labels[] = __('Text'); } if (in_array(Sppc_Channel::AD_TYPE_IMAGE, $allowedTypes)) { $keys[] = 'image'; $labels[] = __('Image'); } $key = implode(',', $keys); $label = implode(' & ', $labels); $programs = $sites_channels_programs[$sites_channels_array[$i]['id_site_channel']]; if (in_array('CPM', $program_types_options) || isset($programs['restrictions']) && $programs['restrictions']['flat_rate_image_is_allowed']) { $ad_types_options[$key] = $label; } } $js = 'id_site_channel="' . $sites_channels_array[$i]['id_site_channel'] . '" id="site_channel_' . $sites_channels_array[$i]['id_site_channel'] . '_ad_type" class="w200" onchange="onChangeAdType(' . $sites_channels_array[$i]['id_site_channel'] . ',' . $sites_channels_array[$i]['id_channel'] . ');"'; $this->table_builder->set_cell_content($row_counter, 3, form_dropdown('site_channel_' . $sites_channels_array[$i]['id_site_channel'] . '_ad_type', $ad_types_options, $selected_ad_type, $js)); $js = 'id_site_channel="' . $sites_channels_array[$i]['id_site_channel'] . '" id="site_channel_' . $sites_channels_array[$i]['id_site_channel'] . '_program_type" onchange="onChangeProgramType(' . $sites_channels_array[$i]['id_site_channel'] . ',' . $sites_channels_array[$i]['id_channel'] . ');"'; $this->table_builder->set_cell_content($row_counter, 4, form_dropdown('site_channel_' . $sites_channels_array[$i]['id_site_channel'] . '_program_type', $program_types_options, $selected_program_type, $js)); $js = 'id_site_channel="' . $sites_channels_array[$i]['id_site_channel'] . '" id_channel="' . $sites_channels_array[$i]['id_channel'] . '" class="site_channel_program w100p" id="site_channel_' . $sites_channels_array[$i]['id_site_channel'] . '_option" onchange="onChangeProgramOption(' . $sites_channels_array[$i]['id_site_channel'] . ',' . $sites_channels_array[$i]['id_channel'] . ');"'; $this->table_builder->set_cell_content($row_counter, 5, form_dropdown('site_channel_' . $sites_channels_array[$i]['id_site_channel'] . '_program_option', $program_cost_options, $selected_cost_option, $js)); $this->table_builder->set_cell_content($row_counter, 7, type_to_str($sites_channels_array[$i]['impressions'], 'impressions')); $this->table_builder->set_cell_content($row_counter, 8, '<input type="button" type="button" class="guibutton floatl ico ico-delete" jframe="no" value="' . __('Delete') . '" onclick="return ' . $delete_js_function . '(' . $sites_channels_array[$i]['id_site_channel'] . ')">'); $this->table_builder->add_row_attribute($row_counter, 'id', "tr{$sites_channels_array[$i]['id_site_channel']}"); $this->table_builder->add_row_attribute($row_counter, 'id_site_channel', $sites_channels_array[$i]['id_site_channel']); if ('new' == $status_filter) { $this->table_builder->add_row_attribute($row_counter, 'class', 'new_row'); } $row_counter++; } if (0 == $data_rows_conut) { $this->table_builder->set_cell_content(1, 0, __('Records not found')); $this->table_builder->cell(1, 0)->add_attribute('colspan', 9); $this->table_builder->cell(1, 0)->add_attribute('class', 'nodata'); $total_campaign_cost_hint_visibility = 'style="display:none;"'; } else { //Тotal row for new sites/channels if ('new' == $status_filter) { $this->table_builder->set_cell_content($row_counter, 0, __('Total') . ':'); $this->table_builder->set_cell_content($row_counter, 1, ' '); $this->table_builder->cell($row_counter, 0)->add_attribute('colspan', 5); $this->table_builder->cell($row_counter, 1)->add_attribute('colspan', 4); $this->table_builder->cell($row_counter, 1)->add_attribute('id', 'total_cost'); $this->table_builder->cell($row_counter, 0)->add_attribute('class', 'b'); $this->table_builder->cell($row_counter, 1)->add_attribute('class', 'b'); $this->table_builder->cell($row_counter, 0)->add_attribute('style', 'border-top:1px solid #000000;'); $this->table_builder->cell($row_counter, 1)->add_attribute('style', 'border-top:1px solid #000000;'); } $total_campaign_cost_hint_visibility = ''; } // Устанавливаем возможность выбора колонок $this->table_builder->use_select_columns(); $invariable_columns = array(0, 1, 3, 4, 5, 8); $this->table_builder->set_invariable_columns($invariable_columns); $table = $this->table_builder->get_sort_html(); $columns = $this->table_builder->get_columns_html(); $this->template = "common/parent/jq_iframe.html"; if ('new' == $status_filter) { $iframe_form_template = 'iframe_recently_added_channels_table.html'; } else { $iframe_form_template = 'iframe_added_channels_table.html'; } $this->_set_content($this->parser->parse('advertiser/manage_ads/campaigns/creation/set_pricing/' . $iframe_form_template, array('CHANNELS_TABLE' => $table, 'SITES_CHANNELS_PROGRAMS' => json_encode($sites_channels_programs), 'TOTAL_CAMPAIGN_COST_HINT_VISIBILITY' => $total_campaign_cost_hint_visibility, 'COLUMNS' => $columns), TRUE)); $this->_display(); }