Example #1
0
/**
 * Returns all user tags for XTemplate
 *
 * @param mixed $user_data User Info Array
 * @param string $tag_prefix Prefix for tags
 * @param string $emptyname Name text if user is not exist
 * @param bool $allgroups Build info about all user groups
 * @param bool $cacheitem Cache tags
 * @return array
 * @global CotDB $db
 */
function cot_generate_usertags($user_data, $tag_prefix = '', $emptyname = '', $allgroups = false, $cacheitem = true)
{
    global $db, $cot_extrafields, $cot_groups, $cfg, $L, $user_cache, $db_users;
    static $extp_first = null, $extp_main = null;
    $return_array = array();
    if (is_null($extp_first)) {
        $extp_first = cot_getextplugins('usertags.first');
        $extp_main = cot_getextplugins('usertags.main');
    }
    /* === Hook === */
    foreach ($extp_first as $pl) {
        include $pl;
    }
    /* ===== */
    $user_id = is_array($user_data) ? (int) $user_data['user_id'] : (is_numeric($user_data) ? (int) $user_data : 0);
    if (isset($user_cache[$user_id])) {
        $temp_array = $user_cache[$user_id];
    } else {
        if (!is_array($user_data) && $user_id > 0) {
            $sql = $db->query("SELECT * FROM {$db_users} WHERE user_id = {$user_id} LIMIT 1");
            $user_data = $sql->fetch();
        } else {
            if (!is_array($user_data)) {
                $user_data = array();
            }
        }
        if (is_array($user_data) && $user_data['user_id'] > 0 && !empty($user_data['user_name'])) {
            $user_data['user_birthdate'] = cot_date2stamp($user_data['user_birthdate']);
            $user_data['user_text'] = cot_parse($user_data['user_text'], $cfg['users']['usertextimg']);
            $temp_array = array('ID' => $user_data['user_id'], 'NAME' => cot_build_user($user_data['user_id'], htmlspecialchars($user_data['user_name'])), 'NICKNAME' => htmlspecialchars($user_data['user_name']), 'DETAILSLINK' => cot_url('users', 'm=details&id=' . $user_data['user_id'] . '&u=' . htmlspecialchars($user_data['user_name'])), 'DETAILSLINKSHORT' => cot_url('users', 'm=details&id=' . $user_data['user_id']), 'FULL_NAME' => htmlspecialchars(cot_user_full_name($user_data)), 'TITLE' => $cot_groups[$user_data['user_maingrp']]['title'], 'MAINGRP' => cot_build_group($user_data['user_maingrp']), 'MAINGRPID' => $user_data['user_maingrp'], 'MAINGRPNAME' => $cot_groups[$user_data['user_maingrp']]['name'], 'MAINGRPTITLE' => cot_build_group($user_data['user_maingrp'], true), 'MAINGRPSTARS' => cot_build_stars($cot_groups[$user_data['user_maingrp']]['level']), 'MAINGRPICON' => cot_build_groupicon($cot_groups[$user_data['user_maingrp']]['icon']), 'COUNTRY' => cot_build_country($user_data['user_country']), 'COUNTRYFLAG' => cot_build_flag($user_data['user_country']), 'TEXT' => $user_data['user_text'], 'EMAIL' => cot_build_email($user_data['user_email'], $user_data['user_hideemail']), 'THEME' => $user_data['user_theme'], 'SCHEME' => $user_data['user_scheme'], 'LANG' => $user_data['user_lang'], 'GENDER' => $user_data['user_gender'] == '' || $user_data['user_gender'] == 'U' ? '' : $L['Gender_' . $user_data['user_gender']], 'BIRTHDATE' => is_null($user_data['user_birthdate']) ? '' : cot_date('date_full', $user_data['user_birthdate']), 'BIRTHDATE_STAMP' => is_null($user_data['user_birthdate']) ? '' : $user_data['user_birthdate'], 'AGE' => is_null($user_data['user_birthdate']) ? '' : cot_build_age($user_data['user_birthdate']), 'TIMEZONE' => cot_build_timezone(cot_timezone_offset($user_data['user_timezone'], false, false)) . ' ' . str_replace('_', ' ', $user_data['user_timezone']), 'REGDATE' => cot_date('datetime_medium', $user_data['user_regdate']), 'REGDATE_STAMP' => $user_data['user_regdate'], 'LASTLOG' => cot_date('datetime_medium', $user_data['user_lastlog']), 'LASTLOG_STAMP' => $user_data['user_lastlog'], 'LOGCOUNT' => $user_data['user_logcount'], 'POSTCOUNT' => $user_data['user_postcount'], 'LASTIP' => $user_data['user_lastip']);
            if ($allgroups) {
                $temp_array['GROUPS'] = cot_build_groupsms($user_data['user_id'], FALSE, $user_data['user_maingrp']);
            }
            // Extra fields
            if (isset($cot_extrafields[$db_users])) {
                foreach ($cot_extrafields[$db_users] as $exfld) {
                    $temp_array[strtoupper($exfld['field_name'])] = cot_build_extrafields_data('user', $exfld, $user_data['user_' . $exfld['field_name']]);
                    $temp_array[strtoupper($exfld['field_name']) . '_TITLE'] = isset($L['user_' . $exfld['field_name'] . '_title']) ? $L['user_' . $exfld['field_name'] . '_title'] : $exfld['field_description'];
                    $temp_array[strtoupper($exfld['field_name']) . '_VALUE'] = $user_data['user_' . $exfld['field_name']];
                }
            }
        } else {
            $temp_array = array('ID' => 0, 'NAME' => !empty($emptyname) ? $emptyname : $L['Deleted'], 'NICKNAME' => !empty($emptyname) ? $emptyname : $L['Deleted'], 'FULL_NAME' => !empty($emptyname) ? $emptyname : $L['Deleted'], 'MAINGRP' => cot_build_group(1), 'MAINGRPID' => 1, 'MAINGRPSTARS' => '', 'MAINGRPICON' => cot_build_groupicon($cot_groups[1]['icon']), 'COUNTRY' => cot_build_country(''), 'COUNTRYFLAG' => cot_build_flag(''), 'TEXT' => '', 'EMAIL' => '', 'GENDER' => '', 'BIRTHDATE' => '', 'BIRTHDATE_STAMP' => '', 'AGE' => '', 'REGDATE' => '', 'REGDATE_STAMP' => '', 'POSTCOUNT' => '', 'LASTIP' => '');
        }
        /* === Hook === */
        foreach ($extp_main as $pl) {
            include $pl;
        }
        /* ===== */
        if (is_array($user_data) && isset($user_data['user_id'])) {
            $cacheitem && ($user_cache[$user_data['user_id']] = $temp_array);
        }
    }
    foreach ($temp_array as $key => $val) {
        $return_array[$tag_prefix . $key] = $val;
    }
    return $return_array;
}
Example #2
0
$title_params = array('EDIT' => $L['Edit'], 'NAME' => $urr['user_name']);
$out['subtitle'] = cot_title('{EDIT} - {NAME}', $title_params);
$out['head'] .= $R['code_noindex'];
$mskin = cot_tplfile(array('users', 'edit', $usr['maingrp']), 'module');
/* === Hook === */
foreach (cot_getextplugins('users.edit.main') as $pl) {
    include $pl;
}
/* ===== */
require_once $cfg['system_dir'] . '/header.php';
$t = new XTemplate($mskin);
require_once cot_incfile('forms');
$protected = $sys['protecttopadmin'] ? array('disabled' => 'disabled') : array();
$editor_class = $cfg['users']['usertextimg'] ? 'minieditor' : '';
$delete_pfs = cot_module_active('pfs') ? cot_checkbox(false, 'ruserdelpfs', $L['PFS']) : '';
$t->assign(array('USERS_EDIT_TITLE' => cot_breadcrumbs(array(array(cot_url('users'), $L['Users']), array(cot_url('users', 'm=details&id=' . $urr['user_id'] . '&u=' . $urr['user_name']), $urr['user_name']), array(cot_url('users', 'm=edit&id=' . $urr['user_id']), $L['Edit'])), $cfg['homebreadcrumb']), 'USERS_EDIT_DETAILSLINK' => cot_url('users', 'm=details&id=' . $urr['user_id']), 'USERS_EDIT_EDITLINK' => cot_url('users', 'm=edit&id=' . $urr['user_id']), 'USERS_EDIT_SUBTITLE' => $L['useed_subtitle'], 'USERS_EDIT_SEND' => cot_url('users', 'm=edit&a=update&' . cot_xg() . '&id=' . $urr['user_id']), 'USERS_EDIT_ID' => $urr['user_id'], 'USERS_EDIT_NAME' => cot_inputbox('text', 'rusername', $urr['user_name'], array('size' => 32, 'maxlength' => 100) + $protected), 'USERS_EDIT_ACTIVE' => $user_form_active, 'USERS_EDIT_BANNED' => $user_form_banned, 'USERS_EDIT_THEME' => cot_inputbox('text', 'rusertheme', $urr['user_theme'], array('size' => 32, 'maxlength' => 32)), 'USERS_EDIT_LANG' => cot_inputbox('text', 'ruserlang', $urr['user_lang'], array('size' => 32, 'maxlength' => 32)), 'USERS_EDIT_NEWPASS' => cot_inputbox('password', 'rusernewpass', '', array('size' => 12, 'maxlength' => 32, 'autocomplete' => 'off') + $protected), 'USERS_EDIT_MAINGRP' => cot_build_group($urr['user_maingrp']), 'USERS_EDIT_GROUPS' => cot_build_groupsms($urr['user_id'], $usr['isadmin'], $urr['user_maingrp']), 'USERS_EDIT_COUNTRY' => cot_selectbox_countries($urr['user_country'], 'rusercountry'), 'USERS_EDIT_EMAIL' => cot_inputbox('text', 'ruseremail', $urr['user_email'], array('size' => 32, 'maxlength' => 64)), 'USERS_EDIT_HIDEEMAIL' => cot_radiobox($urr['user_hideemail'], 'ruserhideemail', array(1, 0), array($L['Yes'], $L['No'])), 'USERS_EDIT_TEXT' => cot_textarea('rusertext', $urr['user_text'], 4, 56, array('class' => $editor_class)), 'USERS_EDIT_GENDER' => cot_selectbox_gender($urr['user_gender'], 'rusergender'), 'USERS_EDIT_BIRTHDATE' => cot_selectbox_date(cot_date2stamp($urr['user_birthdate']), 'short', 'ruserbirthdate', cot_date('Y', $sys['now']), cot_date('Y', $sys['now']) - 100, false), 'USERS_EDIT_TIMEZONE' => cot_selectbox_timezone($urr['user_timezone'], 'rusertimezone'), 'USERS_EDIT_REGDATE' => cot_date('datetime_medium', $urr['user_regdate']), 'USERS_EDIT_REGDATE_STAMP' => $urr['user_regdate'], 'USERS_EDIT_LASTLOG' => cot_date('datetime_medium', $urr['user_lastlog']), 'USERS_EDIT_LASTLOG_STAMP' => $urr['user_lastlog'], 'USERS_EDIT_LOGCOUNT' => $urr['user_logcount'], 'USERS_EDIT_LASTIP' => cot_build_ipsearch($urr['user_lastip']), 'USERS_EDIT_DELETE' => $sys['user_istopadmin'] ? cot_radiobox(0, 'ruserdelete', array(1, 0), array($L['Yes'], $L['No'])) . $delete_pfs : $L['na']));
// Extra fields
foreach ($cot_extrafields[$db_users] as $exfld) {
    $tag = strtoupper($exfld['field_name']);
    $t->assign(array('USERS_EDIT_' . $tag => cot_build_extrafields('ruser' . $exfld['field_name'], $exfld, $urr['user_' . $exfld['field_name']]), 'USERS_EDIT_' . $tag . '_TITLE' => isset($L['user_' . $exfld['field_name'] . '_title']) ? $L['user_' . $exfld['field_name'] . '_title'] : $exfld['field_description']));
}
// Error and message reporting
cot_display_messages($t);
/* === Hook === */
foreach (cot_getextplugins('users.edit.tags') as $pl) {
    include $pl;
}
/* ===== */
$t->parse('MAIN');
$t->out('MAIN');
require_once $cfg['system_dir'] . '/footer.php';
Example #3
0
            </tr>
            </thead>
            <?php 
    $i = $this->fistNumber;
    foreach ($this->items as $itemRow) {
        $bannerEditUrl = cot_url('admin', array('m' => 'brs', 'a' => 'edit', 'id' => $itemRow['banner']));
        ?>
                <tr>
                    <td><?php 
        echo $i;
        ?>
</td>
                    <td>
                        <?php 
        if (!empty($itemRow['date'])) {
            echo cot_date('datetime_medium', cot_date2stamp($itemRow['date'], 'auto'));
        } else {
            echo brs_YesNo(false);
        }
        ?>
                    </td>
                    <td>
                        <a href="<?php 
        echo $bannerEditUrl;
        ?>
"><?php 
        echo htmlspecialchars($itemRow['title']);
        ?>
</a>
                        <div class="text-muted"><?php 
        echo htmlspecialchars($itemRow['categoryTitle']);
Example #4
0
$urr = $sql->fetch();
$out['subtitle'] = $L['Profile'];
$out['head'] .= $R['code_noindex'];
$mskin = cot_tplfile(array('users', 'profile'), 'module');
/* === Hook === */
foreach (cot_getextplugins('users.profile.main') as $pl) {
    include $pl;
}
/* ===== */
require_once $cfg['system_dir'] . '/header.php';
$t = new XTemplate($mskin);
require_once cot_incfile('forms');
$protected = !$cfg['users']['useremailchange'] ? array('disabled' => 'disabled') : array();
$profile_form_email = cot_inputbox('text', 'ruseremail', $urr['user_email'], array('size' => 32, 'maxlength' => 64) + $protected);
$editor_class = $cfg['users']['usertextimg'] ? 'minieditor' : '';
$t->assign(array('USERS_PROFILE_TITLE' => cot_rc_link(cot_url('users', 'm=profile'), $L['pro_title']), 'USERS_PROFILE_SUBTITLE' => $L['pro_subtitle'], 'USERS_PROFILE_DETAILSLINK' => cot_url('users', 'm=details&id=' . $urr['user_id']), 'USERS_PROFILE_EDITLINK' => cot_url('users', 'm=edit&id=' . $urr['user_id']), 'USERS_PROFILE_FORM_SEND' => cot_url('users', "m=profile&a=update&" . cot_xg()), 'USERS_PROFILE_ID' => $urr['user_id'], 'USERS_PROFILE_NAME' => htmlspecialchars($urr['user_name']), 'USERS_PROFILE_MAINGRP' => cot_build_group($urr['user_maingrp']), 'USERS_PROFILE_GROUPS' => cot_build_groupsms($urr['user_id'], FALSE, $urr['user_maingrp']), 'USERS_PROFILE_COUNTRY' => cot_selectbox_countries($urr['user_country'], 'rusercountry'), 'USERS_PROFILE_TEXT' => cot_textarea('rusertext', $urr['user_text'], 8, 56, array('class' => $editor_class)), 'USERS_PROFILE_EMAIL' => $profile_form_email, 'USERS_PROFILE_EMAILPASS' => cot_inputbox('password', 'rmailpass', '', array('size' => 12, 'maxlength' => 32, 'autocomplete' => 'off')), 'USERS_PROFILE_HIDEEMAIL' => cot_radiobox($urr['user_hideemail'], 'ruserhideemail', array(1, 0), array($L['Yes'], $L['No'])), 'USERS_PROFILE_THEME' => cot_selectbox_theme($urr['user_theme'], $urr['user_scheme'], 'rusertheme'), 'USERS_PROFILE_LANG' => cot_selectbox_lang($urr['user_lang'], 'ruserlang'), 'USERS_PROFILE_GENDER' => cot_selectbox_gender($urr['user_gender'], 'rusergender'), 'USERS_PROFILE_BIRTHDATE' => cot_selectbox_date(cot_date2stamp($urr['user_birthdate']), 'short', 'ruserbirthdate', cot_date('Y', $sys['now']), cot_date('Y', $sys['now']) - 100, false), 'USERS_PROFILE_TIMEZONE' => cot_selectbox_timezone($urr['user_timezone'], 'rusertimezone'), 'USERS_PROFILE_REGDATE' => cot_date('datetime_medium', $urr['user_regdate']), 'USERS_PROFILE_REGDATE_STAMP' => $urr['user_regdate'], 'USERS_PROFILE_LASTLOG' => cot_date('datetime_medium', $urr['user_lastlog']), 'USERS_PROFILE_LASTLOG_STAMP' => $urr['user_lastlog'], 'USERS_PROFILE_LOGCOUNT' => $urr['user_logcount'], 'USERS_PROFILE_ADMINRIGHTS' => '', 'USERS_PROFILE_OLDPASS' => cot_inputbox('password', 'roldpass', '', array('size' => 12, 'maxlength' => 32)), 'USERS_PROFILE_NEWPASS1' => cot_inputbox('password', 'rnewpass1', '', array('size' => 12, 'maxlength' => 32, 'autocomplete' => 'off')), 'USERS_PROFILE_NEWPASS2' => cot_inputbox('password', 'rnewpass2', '', array('size' => 12, 'maxlength' => 32, 'autocomplete' => 'off'))));
// Extra fields
if (!empty(cot::$extrafields[cot::$db->users])) {
    foreach (cot::$extrafields[cot::$db->users] as $exfld) {
        $uname = strtoupper($exfld['field_name']);
        $exfld_val = cot_build_extrafields('ruser' . $exfld['field_name'], $exfld, $urr['user_' . $exfld['field_name']]);
        $exfld_title = cot_extrafield_title($exfld, 'user_');
        $t->assign(array('USERS_PROFILE_' . $uname => $exfld_val, 'USERS_PROFILE_' . $uname . '_TITLE' => $exfld_title, 'USERS_PROFILE_EXTRAFLD' => $exfld_val, 'USERS_PROFILE_EXTRAFLD_TITLE' => $exfld_title));
        $t->parse('MAIN.EXTRAFLD');
    }
}
/* === Hook === */
foreach (cot_getextplugins('users.profile.tags') as $pl) {
    include $pl;
}
/* ===== */
Example #5
0
 /**
  * Создание / редактирование купона
  * @todo произвольный урл баннера
  * @return string
  */
 public function editAction()
 {
     global $admintitle, $adminpath, $structure, $cot_import_filters;
     $adminpath[] = array(cot_url('admin', array('m' => 'brs')), cot::$L['brs_banners']);
     if (empty($structure['brs'])) {
         cot_error(cot::$L['brs_category_no']);
     }
     $id = cot_import('id', 'G', 'INT');
     $act = cot_import('act', 'P', 'ALP');
     if (!$id) {
         $id = 0;
         $item = new brs_model_Banner();
         $admintitle = $title = cot::$L['brs_banner_new'];
         $adminpath[] = array(cot_url('admin', array('m' => 'brs', 'a' => 'edit')), cot::$L['brs_banner_new']);
     } else {
         $item = brs_model_Banner::getById($id);
         if (!$item) {
             cot_error(cot::$L['brs_err_not_found']);
             cot_redirect(cot_url('admin', array('m' => 'brs'), '', true));
         }
         $title = htmlspecialchars($item->title) . ' [' . cot::$L['Edit'] . ']';
         $admintitle = cot::$L['brs_banner_edit'];
         $adminpath[] = array(cot_url('admin', array('m' => 'brs', 'a' => 'edit', 'id' => $id)), $title);
     }
     if ($act == 'save') {
         unset($_POST['id']);
         $data = $_POST;
         $nullDate = date('Y-m-d H:i:s', 0);
         // 1970-01-01 00:00:00
         // Импортируем файл
         $file = brs_importFile('file', $item->file);
         $delFile = cot_import('del_file', 'P', 'BOL') ? 1 : 0;
         if ($delFile) {
             $data['file'] = '';
         }
         // Импортируем даты
         $data['publish_up'] = cot_import_date('publish_up');
         if (!empty($data['publish_up'])) {
             $data['publish_up'] = date('Y-m-d H:i:s', $data['publish_up']);
         } else {
             $data['publish_up'] = $nullDate;
         }
         $data['publish_down'] = cot_import_date('publish_down');
         if (!empty($data['publish_down'])) {
             $data['publish_down'] = date('Y-m-d H:i:s', $data['publish_down']);
         } else {
             $data['publish_down'] = $nullDate;
         }
         $bannerType = cot_import('banner_type', 'P', 'INT');
         unset($data['banner_type']);
         if (isset($data['client'])) {
             $data['client'] = (int) $data['client'];
         }
         // Отключим html-фильтры для установк произвольного кода:
         $tmp = $cot_import_filters['HTM'] = array();
         $item->setData($data);
         if ($bannerType == brs_model_Banner::TYPE_CUSTOM) {
             $item->type = $bannerType;
         }
         $cot_import_filters['HTM'] = $tmp;
         if (!empty($file)) {
             $fileProps = brs_fileProperties($file);
             if (empty($fileProps)) {
                 $item->type = brs_model_Banner::TYPE_UNKNOWN;
                 cot_error(cot::$L['brs_err_inv_file_type'], 'file');
             } else {
                 if (empty($item->width)) {
                     $item->width = $fileProps['width'];
                 }
                 if (empty($item->height)) {
                     $item->height = $fileProps['height'];
                 }
                 if ($item->type != brs_model_Banner::TYPE_CUSTOM) {
                     $item->type = $fileProps['type'];
                 }
                 if ($fileProps['type'] == brs_model_Banner::TYPE_UNKNOWN) {
                     $item->type = brs_model_Banner::TYPE_UNKNOWN;
                     cot_error(cot::$L['brs_err_inv_file_type'], 'file');
                 }
             }
         } elseif ($bannerType != brs_model_Banner::TYPE_CUSTOM) {
             // Если файл не передан
             if ($delFile) {
                 $item->type = brs_model_Banner::TYPE_UNKNOWN;
             } elseif (!empty($item->file)) {
                 $item->type = brs_type($item->file);
             }
         }
         $item->validate();
         $backUrl = array('m' => 'brs', 'a' => 'edit');
         if ($item->id > 0) {
             $backUrl['id'] = $item->id;
         }
         if (!cot_error_found()) {
             if (!empty($file)) {
                 $item->file = $file;
             }
             if ($id = $item->save()) {
                 cot_message(cot::$L['Saved']);
             } else {
                 // Удалим загруженный файл
                 if (!empty($file) && file_exists($file)) {
                     unlink($file);
                 }
             }
             $backUrl['id'] = $item->id;
             cot_redirect(cot_url('admin', $backUrl, '', true));
         } else {
             // Удалим загруженный файл
             if (!empty($file) && file_exists($file)) {
                 unlink($file);
             }
             cot_redirect(cot_url('admin', $backUrl, '', true));
         }
     }
     $deleteUrl = '';
     if ($item->id > 0) {
         $deleteUrl = cot_confirm_url(cot_url('admin', array('m' => 'brs', 'a' => 'delete', 'id' => $item->id)), 'admin');
     }
     $types = array('0' => cot::$L['brs_type_file'], brs_model_Banner::TYPE_CUSTOM => cot::$L['brs_custom_code']);
     $clients = brs_model_Client::keyValPairs();
     if (!$clients) {
         $clients = array();
     }
     $purchase = array(brs_model_Client::PURCHASE_DEFAULT => cot::$L['brs_client_default'], brs_model_Client::PURCHASE_UNLIMITED => cot::$L['brs_unlimited'], brs_model_Client::PURCHASE_YEARLY => cot::$L['brs_pt_yearly'], brs_model_Client::PURCHASE_MONTHLY => cot::$L['brs_pt_monthly'], brs_model_Client::PURCHASE_WEEKLY => cot::$L['brs_pt_weekly'], brs_model_Client::PURCHASE_DAILY => cot::$L['brs_pt_daily']);
     $track = array(-1 => cot::$L['brs_client_default'], 0 => cot::$L['No'], 1 => cot::$L['Yes']);
     $formFile = cot_inputbox('file', 'file', $item->file);
     if (!empty($item->file)) {
         $formFile .= cot_checkbox(false, 'del_file', cot::$L['Delete']);
     }
     $published = $item->published;
     if ($item->id == 0 && !isset($_POST['published'])) {
         $published = 1;
     }
     $showForm = true;
     if (empty($structure['brs'])) {
         $showForm = false;
     }
     $bannerType = 0;
     if ($item->type == brs_model_Banner::TYPE_CUSTOM) {
         $bannerType = brs_model_Banner::TYPE_CUSTOM;
     }
     /* === Hook === */
     foreach (cot_getextplugins('brs.admin.edit.main') as $pl) {
         include $pl;
     }
     /* ===== */
     $formElements = array('hidden' => array('element' => cot_inputbox('hidden', 'act', 'save')), 'title' => array('element' => cot_inputbox('text', 'title', $item->rawValue('title')), 'required' => true, 'label' => brs_model_Banner::fieldLabel('title')), 'category' => array('element' => cot_selectbox_structure('brs', $item->rawValue('category'), 'category', '', false, false), 'required' => true, 'label' => brs_model_Banner::fieldLabel('category')), 'type' => array('element' => cot_selectbox($bannerType, 'banner_type', array_keys($types), array_values($types), false), 'label' => brs_model_Banner::fieldLabel('type')), 'file' => array('element' => $formFile, 'label' => brs_model_Banner::fieldLabel('file')), 'width' => array('element' => cot_inputbox('text', 'width', $item->width), 'label' => brs_model_Banner::fieldLabel('width')), 'height' => array('element' => cot_inputbox('text', 'height', $item->height), 'label' => brs_model_Banner::fieldLabel('height')), 'alt' => array('element' => cot_inputbox('text', 'alt', $item->alt), 'label' => brs_model_Banner::fieldLabel('alt')), 'customcode' => array('element' => cot_textarea('customcode', $item->customcode, 5, 60), 'label' => brs_model_Banner::fieldLabel('customcode')), 'clickurl' => array('element' => cot_inputbox('text', 'clickurl', $item->clickurl), 'label' => brs_model_Banner::fieldLabel('clickurl')), 'description' => array('element' => cot_textarea('description', $item->description, 5, 60), 'label' => brs_model_Banner::fieldLabel('description')), 'sticky' => array('element' => cot_checkbox($item->sticky, 'sticky', brs_model_Banner::fieldLabel('sticky')), 'hint' => cot::$L['brs_sticky_tip']), 'publish_up' => array('element' => cot_selectbox_date(cot_date2stamp($item->publish_up, 'auto'), 'long', 'publish_up'), 'label' => brs_model_Banner::fieldLabel('publish_up')), 'publish_down' => array('element' => cot_selectbox_date(cot_date2stamp($item->publish_down, 'auto'), 'long', 'publish_down'), 'label' => brs_model_Banner::fieldLabel('publish_down')), 'imptotal' => array('element' => cot_inputbox('text', 'imptotal', $item->imptotal), 'label' => brs_model_Banner::fieldLabel('imptotal'), 'hint' => '0 - ' . cot::$L['brs_unlimited']), 'impressions' => array('element' => cot_inputbox('text', 'impressions', $item->impressions), 'label' => brs_model_Banner::fieldLabel('impressions')), 'clicks' => array('element' => cot_inputbox('text', 'clicks', $item->clicks), 'label' => brs_model_Banner::fieldLabel('clicks')), 'client' => array('element' => cot_selectbox($item->rawValue('client'), 'client', array_keys($clients), array_values($clients), true), 'label' => brs_model_Banner::fieldLabel('client')), 'purchase_type' => array('element' => cot_selectbox($item->rawValue('purchase_type'), 'purchase_type', array_keys($purchase), array_values($purchase), false), 'label' => brs_model_Banner::fieldLabel('purchase_type')), 'track_impressions' => array('element' => cot_selectbox($item->rawValue('track_impressions'), 'track_impressions', array_keys($track), array_values($track), false), 'label' => brs_model_Banner::fieldLabel('track_impressions'), 'hint' => cot::$L['brs_track_impressions_hint']), 'track_clicks' => array('element' => cot_selectbox($item->rawValue('track_clicks'), 'track_clicks', array_keys($track), array_values($track), false), 'label' => brs_model_Banner::fieldLabel('track_clicks'), 'hint' => cot::$L['brs_track_clicks_hint']), 'published' => array('element' => cot_checkbox($published, 'published', brs_model_Banner::fieldLabel('published'))));
     // Превью загруженного файла
     $banner_image = '';
     if (!empty($item->file)) {
         $type = $item->type;
         $imgArr = array(brs_model_Banner::TYPE_IMAGE, brs_model_Banner::TYPE_FLASH);
         if (in_array($item->type, $imgArr)) {
             $w = $item->width;
             $h = $item->height;
         } else {
             $fileProps = brs_fileProperties($item->file);
             if (!empty($fileProps)) {
                 $type = $fileProps['type'];
                 $w = $fileProps['width'];
                 $h = $fileProps['height'];
             }
         }
         if (in_array($type, $imgArr)) {
             // расчитаем размеры картинки:
             if ($h > 100) {
                 $k = $w / $h;
                 $h = 100;
                 $w = intval($h * $k);
             }
             if ($type == brs_model_Banner::TYPE_IMAGE) {
                 $rc = 'banner_image_admin';
             } elseif ($type == brs_model_Banner::TYPE_FLASH) {
                 $rc = 'banner_flash_admin';
             }
             $image = cot_rc($rc, array('file' => $item->file, 'alt' => $item->alt, 'width' => $w, 'height' => $h));
             $banner_image = cot_rc('admin_banner', array('banner' => $image));
         } else {
             // Просто выведем путь к файлу:
             $banner_image = cot_rc('admin_banner', array('banner' => $item->file));
         }
     }
     // /Превью загруженного файла
     $actionParams = array('m' => 'brs', 'a' => 'edit');
     if ($item->id > 0) {
         $actionParams['id'] = $item->id;
     }
     $template = array('brs', 'admin', 'edit');
     $view = new View();
     $view->page_title = $title;
     $view->showForm = $showForm;
     $view->item = $item;
     $view->deleteUrl = $deleteUrl;
     $view->banner_image = $banner_image;
     $view->formElements = $formElements;
     $view->formAction = cot_url('admin', $actionParams);
     /* === Hook === */
     foreach (cot_getextplugins('brs.admin.edit.view') as $pl) {
         include $pl;
     }
     /* ===== */
     return $view->render($template);
 }