function __construct() { parent::__construct(); $this->params = array(); if (isset($_POST['group_id'])) { $this->params['group_id'] = (int) prepare_input($_POST['group_id']); } if (isset($_POST['first_name'])) { $this->params['first_name'] = prepare_input($_POST['first_name']); } if (isset($_POST['last_name'])) { $this->params['last_name'] = prepare_input($_POST['last_name']); } if (isset($_POST['birth_date']) && $_POST['birth_date'] != '') { $this->params['birth_date'] = prepare_input($_POST['birth_date']); } else { $this->params['birth_date'] = '0000-00-00'; } if (isset($_POST['company'])) { $this->params['company'] = prepare_input($_POST['company']); } if (isset($_POST['b_address'])) { $this->params['b_address'] = prepare_input($_POST['b_address']); } if (isset($_POST['b_address_2'])) { $this->params['b_address_2'] = prepare_input($_POST['b_address_2']); } if (isset($_POST['b_city'])) { $this->params['b_city'] = prepare_input($_POST['b_city']); } if (isset($_POST['b_state'])) { $this->params['b_state'] = prepare_input($_POST['b_state']); } if (isset($_POST['b_country'])) { $this->params['b_country'] = prepare_input($_POST['b_country']); } if (isset($_POST['b_zipcode'])) { $this->params['b_zipcode'] = prepare_input($_POST['b_zipcode']); } if (isset($_POST['phone'])) { $this->params['phone'] = prepare_input($_POST['phone']); } if (isset($_POST['fax'])) { $this->params['fax'] = prepare_input($_POST['fax']); } if (isset($_POST['email'])) { $this->params['email'] = prepare_input($_POST['email']); } if (isset($_POST['url'])) { $this->params['url'] = prepare_input($_POST['url'], false, 'medium'); } if (isset($_POST['user_name'])) { $this->params['user_name'] = prepare_input($_POST['user_name']); } if (isset($_POST['user_password'])) { $this->params['user_password'] = prepare_input($_POST['user_password']); } if (isset($_POST['preferred_language'])) { $this->params['preferred_language'] = prepare_input($_POST['preferred_language']); } if (isset($_POST['date_created'])) { $this->params['date_created'] = prepare_input($_POST['date_created']); } if (isset($_POST['date_lastlogin'])) { $this->params['date_lastlogin'] = prepare_input($_POST['date_lastlogin']); } if (isset($_POST['registered_from_ip'])) { $this->params['registered_from_ip'] = prepare_input($_POST['registered_from_ip']); } if (isset($_POST['last_logged_ip'])) { $this->params['last_logged_ip'] = prepare_input($_POST['last_logged_ip']); } if (isset($_POST['email_notifications'])) { $this->params['email_notifications'] = prepare_input($_POST['email_notifications']); } else { $this->params['email_notifications'] = '0'; } if (isset($_POST['notification_status_changed'])) { $this->params['notification_status_changed'] = prepare_input($_POST['notification_status_changed']); } if (isset($_POST['is_active'])) { $this->params['is_active'] = (int) $_POST['is_active']; } else { $this->params['is_active'] = '0'; } if (isset($_POST['is_removed'])) { $this->params['is_removed'] = (int) $_POST['is_removed']; } else { $this->params['is_removed'] = '0'; } if (isset($_POST['comments'])) { $this->params['comments'] = prepare_input($_POST['comments']); } if (isset($_POST['registration_code'])) { $this->params['registration_code'] = prepare_input($_POST['registration_code']); } if (isset($_POST['plan1_listings'])) { $this->params['plan1_listings'] = prepare_input($_POST['plan1_listings']); } if (isset($_POST['plan2_listings'])) { $this->params['plan2_listings'] = prepare_input($_POST['plan2_listings']); } if (isset($_POST['plan3_listings'])) { $this->params['plan3_listings'] = prepare_input($_POST['plan3_listings']); } if (isset($_POST['plan4_listings'])) { $this->params['plan4_listings'] = prepare_input($_POST['plan4_listings']); } $rid = MicroGrid::GetParameter('rid'); $action = MicroGrid::GetParameter('action'); $this->email_notifications = ''; $this->user_password = ''; $this->allow_adding_by_admin = ModulesSettings::Get('customers', 'allow_adding_by_admin'); $this->allow_changing_password = ModulesSettings::Get('customers', 'password_changing_by_admin'); $this->reg_confirmation = ModulesSettings::Get('customers', 'reg_confirmation'); $allow_adding = $this->allow_adding_by_admin == 'yes' ? true : false; $this->primaryKey = 'id'; $this->tableName = TABLE_CUSTOMERS; $this->dataSet = array(); $this->error = ''; ///$this->languageId = (isset($_REQUEST['language_id']) && $_REQUEST['language_id'] != '') ? $_REQUEST['language_id'] : Languages::GetDefaultLang(); $this->formActionURL = 'index.php?admin=mod_customers_management'; $this->actions = array('add' => $allow_adding, 'edit' => true, 'details' => true, 'delete' => true); $this->actionIcons = true; $this->allowRefresh = true; $this->allowTopButtons = true; $this->allowLanguages = false; $this->WHERE_CLAUSE = ''; $this->ORDER_CLAUSE = 'ORDER BY id DESC'; $this->isAlterColorsAllowed = true; $this->isPagingAllowed = true; $this->pageSize = 20; $this->isSortingAllowed = true; $total_countries = Countries::GetAllCountries('priority_order DESC, name ASC'); $arr_countries = array(); foreach ($total_countries[0] as $key => $val) { $arr_countries[$val['abbrv']] = $val['name']; } // prepare plans array $total_plans = AdvertisePlans::GetAllPlans(); $arr_plans = array(); foreach ($total_plans[0] as $key => $val) { $arr_plans[$val['id']] = $val['plan_name']; } // prepare groups array $total_groups = CustomerGroups::GetAllGroups(); $arr_groups = array(); foreach ($total_groups[0] as $key => $val) { $arr_groups[$val['id']] = $val['name']; } // prepare languages array $total_languages = Languages::GetAllActive(); $arr_languages = array(); foreach ($total_languages[0] as $key => $val) { $arr_languages[$val['abbreviation']] = $val['lang_name']; } $this->isFilteringAllowed = true; // define filtering fields $this->arrFilteringFields = array(_FIRST_NAME => array('table' => 'c', 'field' => 'first_name', 'type' => 'text', 'sign' => 'like%', 'width' => '80px'), _LAST_NAME => array('table' => 'c', 'field' => 'last_name', 'type' => 'text', 'sign' => 'like%', 'width' => '80px'), _EMAIL => array('table' => 'c', 'field' => 'email', 'type' => 'text', 'sign' => 'like%', 'width' => '90px'), _ACTIVE => array('table' => 'c', 'field' => 'is_active', 'type' => 'dropdownlist', 'source' => array('0' => _NO, '1' => _YES), 'sign' => '=', 'width' => '85px'), _GROUP => array('table' => 'c', 'field' => 'group_id', 'type' => 'dropdownlist', 'source' => $arr_groups, 'sign' => '=', 'width' => '85px')); $customer_ip = get_current_ip(); $datetime_format = get_datetime_format(); $date_format_view = get_date_format('view'); $date_format_edit = get_date_format('edit'); $default_plan_info = AdvertisePlans::GetDefaultPlanInfo(); $default_plan_id = isset($default_plan_info['id']) ? (int) $default_plan_info['id'] : 0; $default_plan_lc = isset($default_plan_info['listings_count']) ? (int) $default_plan_info['listings_count'] : 0; //---------------------------------------------------------------------- // VIEW MODE //---------------------------------------------------------------------- $this->VIEW_MODE_SQL = 'SELECT c.' . $this->primaryKey . ', c.*, CONCAT(c.first_name, " ", c.last_name) as full_name, IF(c.is_active, "<span class=yes>' . _YES . '</span>", "<span class=no>' . _NO . '</span>") as customer_active, cg.name as group_name FROM ' . $this->tableName . ' c LEFT OUTER JOIN ' . TABLE_CUSTOMER_GROUPS . ' cg ON c.group_id = cg.id '; // define view mode fields $this->arrViewModeFields = array('full_name' => array('title' => _NAME, 'type' => 'label', 'align' => 'left', 'width' => '', 'maxlength' => '20'), 'user_name' => array('title' => _USERNAME, 'type' => 'label', 'align' => 'left', 'width' => '', 'maxlength' => '20'), 'email' => array('title' => _EMAIL_ADDRESS, 'type' => 'link', 'href' => 'mailto:{email}', 'align' => 'left', 'width' => '', 'maxlength' => '36'), 'b_country' => array('title' => _COUNTRY, 'type' => 'enum', 'align' => 'left', 'width' => '', 'sortable' => true, 'nowrap' => '', 'visible' => '', 'source' => $arr_countries), 'customer_active' => array('title' => _ACTIVE, 'type' => 'label', 'align' => 'center', 'width' => '90px'), 'group_name' => array('title' => _GROUP, 'type' => 'label', 'align' => 'left', 'width' => '90px'), 'id' => array('title' => 'ID', 'type' => 'label', 'align' => 'center', 'width' => '50px')); //---------------------------------------------------------------------- // ADD MODE //---------------------------------------------------------------------- // define add mode fields $this->arrAddModeFields = array('separator_1' => array('separator_info' => array('legend' => _PERSONAL_DETAILS), 'first_name' => array('title' => _FIRST_NAME, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'maxlength' => '32', 'validation_type' => 'text'), 'last_name' => array('title' => _LAST_NAME, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'maxlength' => '32', 'validation_type' => 'text'), 'birth_date' => array('title' => _BIRTH_DATE, 'type' => 'date', 'width' => '210px', 'required' => false, 'readonly' => false, 'default' => '', 'validation_type' => 'date', 'unique' => false, 'visible' => true, 'min_year' => '90', 'max_year' => '0', 'format' => 'date', 'format_parameter' => $date_format_edit), 'url' => array('title' => _URL, 'type' => 'textbox', 'width' => '270px', 'required' => false, 'maxlength' => '255', 'validation_type' => 'text')), 'separator_2' => array('separator_info' => array('legend' => _BILLING_ADDRESS), 'company' => array('title' => _COMPANY, 'type' => 'textbox', 'width' => '210px', 'required' => false, 'maxlength' => '128', 'validation_type' => 'text'), 'b_address' => array('title' => _ADDRESS, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'maxlength' => '64', 'validation_type' => 'text'), 'b_address_2' => array('title' => _ADDRESS_2, 'type' => 'textbox', 'width' => '210px', 'required' => false, 'maxlength' => '64', 'validation_type' => 'text'), 'b_city' => array('title' => _CITY, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'maxlength' => '64', 'validation_type' => 'text'), 'b_zipcode' => array('title' => _ZIP_CODE, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'maxlength' => '32', 'validation_type' => 'text'), 'b_country' => array('title' => _COUNTRY, 'type' => 'enum', 'width' => '', 'source' => $arr_countries, 'required' => true), 'b_state' => array('title' => _STATE_PROVINCE, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'maxlength' => '64', 'validation_type' => 'text')), 'separator_3' => array('separator_info' => array('legend' => _CONTACT_INFORMATION), 'phone' => array('title' => _PHONE, 'type' => 'textbox', 'width' => '210px', 'required' => false, 'maxlength' => '32', 'validation_type' => 'text'), 'fax' => array('title' => _FAX, 'type' => 'textbox', 'width' => '210px', 'required' => false, 'maxlength' => '32', 'validation_type' => 'text'), 'email' => array('title' => _EMAIL_ADDRESS, 'type' => 'textbox', 'width' => '230px', 'required' => false, 'maxlength' => '70', 'validation_type' => 'email', 'unique' => true, 'autocomplete' => 'off')), 'separator_4' => array('separator_info' => array('legend' => _ACCOUNT_DETAILS), 'user_name' => array('title' => _USERNAME, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'validation_type' => 'text', 'maxlength' => '32', 'validation_minlength' => '4', 'readonly' => false, 'unique' => true), 'user_password' => array('title' => _PASSWORD, 'type' => 'password', 'width' => '210px', 'required' => true, 'validation_type' => 'password', 'maxlength' => '20', 'cryptography' => PASSWORDS_ENCRYPTION, 'cryptography_type' => PASSWORDS_ENCRYPTION_TYPE, 'aes_password' => PASSWORDS_ENCRYPT_KEY), 'group_id' => array('title' => _CUSTOMER_GROUP, 'type' => 'enum', 'required' => false, 'readonly' => false, 'width' => '', 'source' => $arr_groups), 'preferred_language' => array('title' => _PREFERRED_LANGUAGE, 'type' => 'enum', 'required' => true, 'readonly' => false, 'width' => '120px', 'default' => Application::Get('lang'), 'source' => $arr_languages)), 'separator_5' => array('separator_info' => array('legend' => _OTHER), 'date_created' => array('title' => _DATE_CREATED, 'type' => 'hidden', 'width' => '210px', 'required' => true, 'default' => date('Y-m-d H:i:s')), 'registered_from_ip' => array('title' => _REGISTERED_FROM_IP, 'type' => 'hidden', 'width' => '210px', 'required' => true, 'default' => $customer_ip), 'last_logged_ip' => array('title' => _LAST_LOGGED_IP, 'type' => 'hidden', 'width' => '210px', 'required' => false, 'default' => ''), 'email_notifications' => array('title' => _EMAIL_NOTIFICATION, 'type' => 'checkbox', 'true_value' => '1', 'false_value' => '0'), 'is_active' => array('title' => _ACTIVE, 'type' => 'checkbox', 'readonly' => false, 'default' => '1', 'true_value' => '1', 'false_value' => '0', 'unique' => false), 'is_removed' => array('title' => _REMOVED, 'type' => 'hidden', 'width' => '210px', 'required' => true, 'default' => '0'), 'comments' => array('title' => _COMMENTS, 'type' => 'textarea', 'width' => '420px', 'height' => '70px', 'required' => false, 'readonly' => false, 'validation_type' => 'text', 'validation_maxlength' => '2048'), 'registration_code' => array('title' => _REGISTRATION_CODE, 'type' => 'hidden', 'width' => '210px', 'required' => false, 'default' => ''), 'plan1_listings' => array('title' => _ADVERTISE_PLAN . ' ' . $arr_plans[1], 'type' => 'hidden', 'width' => '210px', 'required' => true, 'default' => $default_plan_id == '1' ? (int) $default_plan_lc : '0'), 'plan2_listings' => array('title' => _ADVERTISE_PLAN . ' ' . $arr_plans[2], 'type' => 'hidden', 'width' => '210px', 'required' => true, 'default' => $default_plan_id == '2' ? (int) $default_plan_lc : '0'), 'plan3_listings' => array('title' => _ADVERTISE_PLAN . ' ' . $arr_plans[3], 'type' => 'hidden', 'width' => '210px', 'required' => true, 'default' => $default_plan_id == '3' ? (int) $default_plan_lc : '0'), 'plan4_listings' => array('title' => _ADVERTISE_PLAN . ' ' . $arr_plans[4], 'type' => 'hidden', 'width' => '210px', 'required' => true, 'default' => $default_plan_id == '4' ? (int) $default_plan_lc : '0'))); //---------------------------------------------------------------------- // EDIT MODE // * password field must be written directly in SQL!!! //---------------------------------------------------------------------- $this->EDIT_MODE_SQL = 'SELECT ' . $this->tableName . '.' . $this->primaryKey . ', ' . $this->tableName . '.*, ' . $this->tableName . '.user_password, ' . $this->tableName . '.date_created, ' . $this->tableName . '.date_lastlogin, ' . $this->tableName . '.notification_status_changed FROM ' . $this->tableName . ' WHERE ' . $this->tableName . '.' . $this->primaryKey . ' = _RID_'; // define edit mode fields $this->arrEditModeFields = array('separator_1' => array('separator_info' => array('legend' => _PERSONAL_DETAILS), 'first_name' => array('title' => _FIRST_NAME, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'maxlength' => '32', 'validation_type' => 'text'), 'last_name' => array('title' => _LAST_NAME, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'maxlength' => '32', 'validation_type' => 'text'), 'birth_date' => array('title' => _BIRTH_DATE, 'type' => 'date', 'width' => '210px', 'required' => false, 'readonly' => false, 'default' => '', 'validation_type' => 'date', 'unique' => false, 'visible' => true, 'min_year' => '90', 'max_year' => '0', 'format' => 'date', 'format_parameter' => $date_format_edit), 'url' => array('title' => _URL, 'type' => 'textbox', 'width' => '270px', 'required' => false, 'maxlength' => '255', 'validation_type' => 'text')), 'separator_2' => array('separator_info' => array('legend' => _BILLING_ADDRESS), 'company' => array('title' => _COMPANY, 'type' => 'textbox', 'width' => '210px', 'required' => false, 'maxlength' => '128', 'validation_type' => 'text'), 'b_address' => array('title' => _ADDRESS, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'maxlength' => '64', 'validation_type' => 'text'), 'b_address_2' => array('title' => _ADDRESS_2, 'type' => 'textbox', 'width' => '210px', 'required' => false, 'maxlength' => '64', 'validation_type' => 'text'), 'b_city' => array('title' => _CITY, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'maxlength' => '64', 'validation_type' => 'text'), 'b_zipcode' => array('title' => _ZIP_CODE, 'type' => 'textbox', 'width' => '210px', 'required' => true, 'maxlength' => '32', 'validation_type' => 'text'), 'b_country' => array('title' => _COUNTRY, 'type' => 'enum', 'width' => '', 'source' => $arr_countries, 'required' => true), 'b_state' => array('title' => _STATE_PROVINCE, 'type' => 'textbox', 'width' => '210px', 'required' => false, 'maxlength' => '64', 'validation_type' => 'text')), 'separator_3' => array('separator_info' => array('legend' => _CONTACT_INFORMATION), 'phone' => array('title' => _PHONE, 'type' => 'textbox', 'width' => '210px', 'required' => false, 'maxlength' => '32', 'validation_type' => 'text'), 'fax' => array('title' => _FAX, 'type' => 'textbox', 'width' => '210px', 'required' => false, 'maxlength' => '32', 'validation_type' => 'text'), 'email' => array('title' => _EMAIL_ADDRESS, 'type' => 'textbox', 'width' => '230px', 'required' => true, 'maxlength' => '70', 'readonly' => false, 'validation_type' => 'email', 'unique' => true, 'autocomplete' => 'off')), 'separator_4' => array('separator_info' => array('legend' => _ACCOUNT_DETAILS), 'user_name' => array('title' => _USERNAME, 'type' => 'label'), 'user_password' => array('title' => _PASSWORD, 'type' => 'password', 'width' => '210px', 'maxlength' => '20', 'required' => true, 'validation_type' => 'password', 'cryptography' => PASSWORDS_ENCRYPTION, 'cryptography_type' => PASSWORDS_ENCRYPTION_TYPE, 'aes_password' => PASSWORDS_ENCRYPT_KEY, 'visible' => $this->allow_changing_password == 'yes' ? true : false), 'group_id' => array('title' => _CUSTOMER_GROUP, 'type' => 'enum', 'required' => false, 'readonly' => false, 'width' => '', 'source' => $arr_groups), 'preferred_language' => array('title' => _PREFERRED_LANGUAGE, 'type' => 'enum', 'required' => true, 'readonly' => false, 'width' => '120px', 'source' => $arr_languages)), 'separator_5' => array('separator_info' => array('legend' => _OTHER), 'date_created' => array('title' => _DATE_CREATED, 'type' => 'label', 'format' => 'date', 'format_parameter' => $datetime_format), 'date_lastlogin' => array('title' => _LAST_LOGIN, 'type' => 'label', 'format' => 'date', 'format_parameter' => $datetime_format), 'registered_from_ip' => array('title' => _REGISTERED_FROM_IP, 'type' => 'label'), 'last_logged_ip' => array('title' => _LAST_LOGGED_IP, 'type' => 'label'), 'email_notifications' => array('title' => _EMAIL_NOTIFICATION, 'type' => 'checkbox', 'true_value' => '1', 'false_value' => '0'), 'notification_status_changed' => array('title' => _NOTIFICATION_STATUS_CHANGED, 'type' => 'label', 'format' => 'date', 'format_parameter' => $datetime_format), 'is_active' => array('title' => _ACTIVE, 'type' => 'checkbox', 'true_value' => '1', 'false_value' => '0'), 'is_removed' => array('title' => _REMOVED, 'type' => 'checkbox', 'true_value' => '1', 'false_value' => '0'), 'comments' => array('title' => _COMMENTS, 'type' => 'textarea', 'width' => '420px', 'height' => '70px', 'required' => false, 'readonly' => false, 'validation_type' => 'text', 'validation_maxlength' => '2048'), 'registration_code' => array('title' => _REGISTRATION_CODE, 'type' => 'hidden', 'width' => '210px', 'required' => false, 'default' => '')), 'separator_6' => array('separator_info' => array('legend' => _LISTINGS), 'orders_count' => array('title' => _ORDERS_COUNT, 'type' => 'label'), 'plan1_listings' => array('title' => _ADVERTISE_PLAN . ' ' . $arr_plans[1], 'type' => 'label'), 'plan2_listings' => array('title' => _ADVERTISE_PLAN . ' ' . $arr_plans[2], 'type' => 'label'), 'plan3_listings' => array('title' => _ADVERTISE_PLAN . ' ' . $arr_plans[3], 'type' => 'label'), 'plan4_listings' => array('title' => _ADVERTISE_PLAN . ' ' . $arr_plans[4], 'type' => 'label'))); //---------------------------------------------------------------------- // DETAILS MODE //---------------------------------------------------------------------- $this->DETAILS_MODE_SQL = 'SELECT c.' . $this->primaryKey . ', c.*, IF(c.email_notifications, "<span class=yes>' . _YES . '</span>", "<span class=no>' . _NO . '</span>") as email_notifications, IF(c.is_active, "<span class=yes>' . _YES . '</span>", "<span class=no>' . _NO . '</span>") as customer_active, IF(c.is_removed, "<span class=yes>' . _YES . '</span>", "<span class=no>' . _NO . '</span>") as customer_removed, c.date_created, c.date_lastlogin, c.notification_status_changed, cg.name as group_name FROM ' . $this->tableName . ' c LEFT OUTER JOIN ' . TABLE_CUSTOMER_GROUPS . ' cg ON c.group_id = cg.id WHERE c.' . $this->primaryKey . ' = _RID_'; $this->arrDetailsModeFields = array('separator_1' => array('separator_info' => array('legend' => _PERSONAL_DETAILS), 'first_name' => array('title' => _FIRST_NAME, 'type' => 'label'), 'last_name' => array('title' => _LAST_NAME, 'type' => 'label'), 'birth_date' => array('title' => _BIRTH_DATE, 'type' => 'date', 'format' => 'date', 'format_parameter' => $date_format_view), 'url' => array('title' => _URL, 'type' => 'label')), 'separator_2' => array('separator_info' => array('legend' => _BILLING_ADDRESS), 'company' => array('title' => _COMPANY, 'type' => 'label'), 'b_address' => array('title' => _ADDRESS, 'type' => 'label'), 'b_address_2' => array('title' => _ADDRESS_2, 'type' => 'label'), 'b_city' => array('title' => _CITY, 'type' => 'label'), 'b_zipcode' => array('title' => _ZIP_CODE, 'type' => 'label'), 'b_country' => array('title' => _COUNTRY, 'type' => 'enum', 'source' => $arr_countries), 'b_state' => array('title' => _STATE_PROVINCE, 'type' => 'label')), 'separator_3' => array('separator_info' => array('legend' => _CONTACT_INFORMATION), 'phone' => array('title' => _PHONE, 'type' => 'label'), 'fax' => array('title' => _FAX, 'type' => 'label'), 'email' => array('title' => _EMAIL_ADDRESS, 'type' => 'label')), 'separator_4' => array('separator_info' => array('legend' => _ACCOUNT_DETAILS), 'user_name' => array('title' => _USERNAME, 'type' => 'label'), 'group_name' => array('title' => _CUSTOMER_GROUP, 'type' => 'label'), 'preferred_language' => array('title' => _PREFERRED_LANGUAGE, 'type' => 'enum', 'source' => $arr_languages)), 'separator_5' => array('separator_info' => array('legend' => _OTHER), 'date_created' => array('title' => _DATE_CREATED, 'type' => 'label', 'format' => 'date', 'format_parameter' => $datetime_format), 'date_lastlogin' => array('title' => _LAST_LOGIN, 'type' => 'label', 'format' => 'date', 'format_parameter' => $datetime_format), 'registered_from_ip' => array('title' => _REGISTERED_FROM_IP, 'type' => 'label'), 'last_logged_ip' => array('title' => _LAST_LOGGED_IP, 'type' => 'label'), 'email_notifications' => array('title' => _EMAIL_NOTIFICATION, 'type' => 'label'), 'notification_status_changed' => array('title' => _NOTIFICATION_STATUS_CHANGED, 'type' => 'label', 'format' => 'date', 'format_parameter' => $datetime_format), 'customer_active' => array('title' => _ACTIVE, 'type' => 'label'), 'customer_removed' => array('title' => _REMOVED, 'type' => 'label'), 'comments' => array('title' => _COMMENTS, 'type' => 'label')), 'separator_6' => array('separator_info' => array('legend' => _LISTINGS), 'orders_count' => array('title' => _ORDERS_COUNT, 'type' => 'label'), 'plan1_listings' => array('title' => _ADVERTISE_PLAN . ' ' . $arr_plans[1], 'type' => 'label'), 'plan2_listings' => array('title' => _ADVERTISE_PLAN . ' ' . $arr_plans[2], 'type' => 'label'), 'plan3_listings' => array('title' => _ADVERTISE_PLAN . ' ' . $arr_plans[3], 'type' => 'label'), 'plan4_listings' => array('title' => _ADVERTISE_PLAN . ' ' . $arr_plans[4], 'type' => 'label'))); }
/** * Draw all languages array * @param $tag_name * @param $selected_value * @param $select_default * @param $draw */ public static function DrawAllCountries($tag_name = 'b_country', $selected_value = '', $select_default = true, $draw = true) { $output = '<select name="' . $tag_name . '" id="' . $tag_name . '">'; $output .= '<option value="">-- ' . _SELECT . ' --</option>'; $countries = Countries::GetAllCountries('priority_order DESC, name ASC'); for ($i = 0; $i < $countries[1]; $i++) { if ($select_default && $countries[0][$i]['is_default'] && empty($selected_value)) { $selected_state = 'selected="selected"'; } else { if ($selected_value == $countries[0][$i]['abbrv']) { $selected_state = 'selected="selected"'; } else { $selected_state = ''; } } $output .= '<option ' . $selected_state . ' value="' . $countries[0][$i]['abbrv'] . '">' . $countries[0][$i]['name'] . '</option>'; } $output .= '</select>'; if ($draw) { echo $output; } else { return $output; } }
/** * Draws advanced search form * @param $draw */ public static function DrawAdvancedSearch($draw = true) { $keyword = isset($_POST['keyword']) ? trim(prepare_input($_POST['keyword'])) : ''; $keyword = str_replace('"', '"', $keyword); $keyword = str_replace("'", ''', $keyword); $search_in = Application::Get('search_in'); $sel_categories = isset($_POST['sel_categories']) ? (int) $_POST['sel_categories'] : ''; $sel_listings_locations = isset($_POST['sel_listings_locations']) ? prepare_input($_POST['sel_listings_locations']) : ''; $sel_listings_sub_locations = isset($_POST['sel_listings_sub_locations']) ? prepare_input($_POST['sel_listings_sub_locations']) : ''; $sel_view = isset($_POST['sel_view']) ? prepare_input($_POST['sel_view']) : ''; $sel_sortby = isset($_POST['sel_sortby']) ? prepare_input($_POST['sel_sortby']) : ''; $sel_orderby = isset($_POST['sel_orderby']) ? prepare_input($_POST['sel_orderby']) : ''; $chk_with_images = isset($_POST['chk_with_images']) ? prepare_input($_POST['chk_with_images']) : ''; // prepare categories array $objCategories = Categories::Instance(); $total_categories = $objCategories->GetAllExistingCategories(); $total_countries = Countries::GetAllCountries('priority_order DESC, name ASC'); $output = '<form style="margin:10px" id="frmAdvSearch" name="frmAdvSearch" action="index.php?page=search_advanced" method="post"> ' . draw_hidden_field('task', 'advanced_search', false) . ' ' . draw_hidden_field('p', '1', false) . ' ' . draw_hidden_field('search_in', 'listings') . ' ' . draw_token_field(false) . ' <input type="text" name="keyword" value="' . $keyword . '" placeholder="' . _SEARCH_KEYWORDS . '..."> <span>' . _IN . '</span> <select name="sel_categories">'; $output .= '<option value="">-- ' . _ALL . ' --</option>'; foreach ($total_categories as $key => $val) { if ($val['level'] == '1') { $category_name = $val['name']; } else { if ($val['level'] == '2') { $category_name = ' • ' . $val['name']; } else { if ($val['level'] == '3') { $category_name = ' :: ' . $val['name']; } } } $output .= '<option ' . ($sel_categories == $val['id'] ? 'selected="selected"' : '') . ' value="' . $val['id'] . '">' . $category_name . '</option>'; } $output .= '</select> '; $output .= ListingsLocations::DrawAllLocations(array('tag_name' => 'sel_listings_locations', 'selected_value' => $sel_listings_locations, 'javascript_event' => 'onchange="jQuery(\'#frmAdvSearch\').submit();"'), false) . ' '; $output .= ListingsSubLocations::DrawAllSubLocations($sel_listings_locations, array('tag_name' => 'sel_listings_sub_locations', 'selected_value' => $sel_listings_sub_locations), false); $output .= '<span style="float:right;"> <input value="' . _SEARCH . '" class="form_button" type="submit"> </span> <div style="padding-top:4px;margin-left:-3px;"> <table><tbody><tr> <td>' . _VIEW . ': <select name="sel_view"> <option value="0" ' . ($sel_view == '0' ? ' selected="selected"' : '') . '>-- ' . _ALL . ' --</option> <option value="1" ' . ($sel_view == '1' ? ' selected="selected"' : '') . '>' . _TODAY . '</option> <option value="2" ' . ($sel_view == '2' ? ' selected="selected"' : '') . '>' . _YESTERDAY . '</option> <option value="3" ' . ($sel_view == '3' ? ' selected="selected"' : '') . '>' . _LAST_7_DAYS . '</option> </select> </td> <td>' . _SORT_BY . ': <select name="sel_sortby"> <option value="0" ' . ($sel_sortby == '0' ? ' selected="selected"' : '') . '>' . _DATE . '</option> <option value="1" ' . ($sel_sortby == '1' ? ' selected="selected"' : '') . '>' . _VIEW . '</option> </select> </td> <td>' . _ORDER_BY . ': <select name="sel_orderby"> <option value="ASC" ' . ($sel_orderby == 'ASC' ? ' selected="selected"' : '') . '>' . _ASCENDING . '</option> <option value="DESC" ' . ($sel_orderby == 'DESC' ? ' selected="selected"' : '') . '>' . _DESCENDING . '</option> </select> </td> <td style="padding-top:4px;"><input name="chk_with_images" type="checkbox" ' . ($chk_with_images == '1' ? ' checked="checked"' : '') . ' value="1">' . _WITH_IMAGES_ONLY . '</td> </tr> </tbody> </table> </div> </form>'; if ($draw) { echo $output; } else { return $output; } }