Files
dev-chiefworks f76abffdcd first commit
2022-05-31 16:21:53 -04:00

785 lines
28 KiB
PHP

<?php
class Combo_model extends CI_Model {
var $optCons = '';
var $currentStyle = 'form-control';
var $readOnlyMode = false;
var $defaultComboMessage = 'Select...';
var $showDefaultSelect = true;
var $defaultComboValue = '';
function __construct() {
parent::__construct();
$this->db = $this->load->database('savvy_replica', true);
}
public function getCardList() {
return 'Tokun';
}
public function getCardIconsCombo($option_name, $curVal) {
$yesno_array = [
'deal' => 'Deal',
'survey' => 'Survey',
'data' => 'Data',
'tip' => 'Tip',
'carpool' => 'Carpool',
'trips' => 'Trips'
];
$option_value = $this->optionValueArray($yesno_array, $curVal);
return $this->comboFrame($option_name, $option_value);
}
//trigger_expiration (description,expiration)
public function getTriggerExpirationCombo($option_name, $curVal) {
$sql = "SELECT expiration AS id,expiration||'-'||description AS description FROM trigger_expiration WHERE status = 1 ORDER BY id ASC ";
$q = $this->db->query($sql);
$option_value = $this->optionValueObject($q->result(), "id", "description", $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getTriggerCardsCombo($option_name, $curVal) {
$sql = "SELECT id,id||'-: '||name||' - '||title AS description FROM main_cards WHERE button1_action = 'CARDDYNAMIC' ";
$q = $this->db->query($sql);
$option_value = $this->optionValueObject($q->result(), "id", "description", $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getPointsSettingsCombo($option_name, $curVal) {
$sql = "SELECT point_key AS id,point_key||'-'||name||' - '||value||' Points' AS description FROM points_settings WHERE value>0 AND activated = 1 ORDER BY id ASC";
$q = $this->db->query($sql);
$option_value = $this->optionValueObject($q->result(), "id", "description", $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getTriggerFrequency($option_name, $curVal)
{
$vals = [1, 2, 3, 4, 5, 6, 7, 10, 14, 30];
$opts[''] = '- Select -';
foreach ($vals as $val) {
$opts[$val] = $val . ($val > 1 ? ' Days' : ' Day');
}
$option_value = $this->optionValueArray($opts, $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getTriggerSendDay($option_name, $curVal)
{
$opts = [
'' => '- Select -',
'instant_send' => 'Instant Send',
'no_day_specified' => 'No Day Specified',
'monday' => 'Monday',
'tuesday' => 'Tuesday',
'wednesday' => 'Wednesday',
'thursday' => 'Thursday',
'friday' => 'Friday',
'saturday' => 'Saturday',
'sunday' => 'Sunday',
];
$option_value = $this->optionValueArray($opts, $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getTriggerSendTime($option_name, $curVal)
{
$opts[''] = '- Select -';
//AM
$opts['00:00:00'] = '12:00 AM';
for ($i = 1; $i <= 11; $i++)
$opts[sprintf('%02d', $i) . ':00:00'] = sprintf('%02d', $i) . ':00 AM';
//PM
$opts['12:00:00'] = '12:00 PM';
for ($i = 1; $i <= 11; $i++)
$opts[sprintf('%02d', $i + 12) . ':00:00'] = sprintf('%02d', $i) . ':00 PM';
$option_value = $this->optionValueArray($opts, $curVal);
return $this->comboFrame($option_name, $option_value);
}
/**
* Get points setting for searching subscription deals report
* @param string $option_name filter name
* @param int $curVal current points
* @return mixed
*/
public function getPointsSubscribedDeals( $option_name, $curVal ) {
$sql = sprintf("SELECT distinct value from points_settings where value > 0 and activated = 1 order by value asc");
$query = $this->db->query( $sql );
$option_value = $this->optionValueObject( $query->result(), 'value', 'value', $curVal );
return $this->comboFrame( $option_name, $option_value );
}
public function getGPSTriggerLocationCombo($option_name, $curVal) {
$sql = "SELECT id, description FROM gps_trigger_location ORDER BY id ASC";
$q = $this->db->query($sql);
$option_value = $this->optionValueObject($q->result(), "id", "description", $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getSurvelListGroupCombo($option_name, $curVal) {
$sql = "SELECT id,title,status FROM main_cards WHERE button1_action = 'SURVEYA' AND status = 1 ORDER BY title";
$q = $this->db->query($sql);
$option_value = $this->optionValueObject($q->result(), "id", "title", $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getfindMemberType(
$option_name,
$curVal,
$yesno_array = [
'email' => 'Email',
'firstname' => 'Firstname',
'lastname' => 'Lastname'
]) {
$option_value = $this->optionValueArray($yesno_array, $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getDescisionGroupCombo($option_name, $curVal) {
$sql = "SELECT dkey,description FROM decision_group where status =1 ORDER by lorder ASC";
$q = $this->db->query($sql);
$option_value = $this->optionValueObject($q->result(), "dkey", "description", $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getCardBehaveCombo($option_name, $curVal) {
$sql = "SELECT * FROM card_behavior WHERE status=1 ";
$q = $this->db->query($sql);
$option_value = $this->optionValueObject($q->result(), "key", "name", $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getCardblogIdCombo($option_name, $curVal) {
$sql = "SELECT blog_id,description, blog_id||'-'||description AS desc2 FROM blog_app_articles WHERE status=1 ORDER BY id ASC";
$q = $this->db->query($sql);
$option_value = $this->optionValueObject($q->result(), "blog_id", "desc2", $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getCardTargetActionCombo($option_name, $curVal) {
$sql = "SELECT * FROM card_action_target WHERE status=1 ";
$q = $this->db->query($sql);
$option_value = $this->optionValueObject($q->result(), "target_key", "description", $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getCardCategoryComboAll($option_name, $curVal) {
$exl2 = "";
$sql = "SELECT * FROM card_category ";
$q = $this->db->query($sql);
$option_value = $this->optionValueObject($q->result(), "cat", "name", $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getCardCategoryCombo($option_name, $curVal, $fixCat = '', $excludeCat = '') {
$exl2 = "";
if (trim($excludeCat) != '') {
$exl2 = " AND cat NOT IN ('$excludeCat')";
}
if (trim($fixCat) == '') {
$sql = "SELECT * FROM card_category WHERE status=1 AND special =0 " . $exl2;
} else {
$sql = "SELECT * FROM card_category WHERE status=1 AND cat='$fixCat' ";
}
$sql = $sql ." ORDER BY name ASC";
$q = $this->db->query($sql);
$option_value = $this->optionValueObject($q->result(), "cat", "name", $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getStatusCombo($option_name, $curVal) {
$yesno_array = [
'0' => 'Not-Active',
'1' => 'Active'
];
$option_value = $this->optionValueArray($yesno_array, $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getTitleShowCombo($option_name, $curVal) {
$yesno_array = [
'1' => 'Show Title',
'0' => 'Hide Title'
];
$option_value = $this->optionValueArray($yesno_array, $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getCardTemplateCombo($option_name, $curVal) {
$yesno_array = [
'0' => 'Default Layout 600x600 Text+image',
'1' => 'Short Layout 600x300 Text+image',
'2' => 'Short Layout 600x300 Image only',
'3' => 'Tall Layout 600x600 image only',
'5' => 'Tall Layout 600x600 image + text',
'4' => 'Short Layout 600x300 Solid Color 1',
'6' => 'Default Layout 600x600 Image only',
'7' => 'Active Tip 600 x 300',
'8' => 'Upper Title 600x600 text + image',
'9' => 'Tall Layout 600x750 text + image',
'10' => 'Tall Layout upper title 600x800 text + image',
];
$option_value = $this->optionValueArray($yesno_array, $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getSurveyCardTemplateCombo($option_name, $curVal) {
$yesno_array = [
'9901' => 'Default Survey',
'9902' => 'Swipe Survey 600 x 600'
];
$option_value = $this->optionValueArray($yesno_array, $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getCardCategoryType($option_name, $curVal) {
$yesno_array = [
'' => 'No Type',
'A' => 'Type A',
'B' => 'Type B',
'C' => 'Type C',
'D' => 'Type D',
'E' => 'Type E'
];
$option_value = $this->optionValueArray($yesno_array, $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getCardLocation($option_name, $curVal) {
$sql = "SELECT id,description FROM address WHERE description != ''";
/*
$yesno_array = [
'0' => 'No Location',
'1' => '4201 Defoors Farm trail, ga 30127',
'2' => 'Location B',
'3' => 'Location C'
];
$option_value = $this->optionValueArray($yesno_array, $curVal);
*/ $this->defaultComboMessage = "No Location Attached";
$this->defaultComboValue = '0';
$q = $this->db->query($sql);
$option_value = $this->optionValueObject($q->result(), "id", "description", $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getReciept($option_name, $curVal) {
$sql = "SELECT id,name,active FROM transport_providers WHERE active =1 ORDER BY name";
$q = $this->db->query($sql);
$option_value = $this->optionValueObject($q->result(), "id", "name", $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getCardPoint($option_name, $curVal) {
$cardtime_array = [
'0' => 'No Points Applicable'
];
for ($i = 1; $i < 24; $i++) {
$points = $i * 50;
$cardtime_array = array_merge($cardtime_array, array($points => "$points Points"));
}
$option_value = $this->optionValueArray($cardtime_array, $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getCardTime($option_name, $curVal) {
$cardtime_array = [
'' => 'No Specific Time',
'12:AM' => '12:AM'
];
for ($i = 1; $i < 12; $i++) {
$cardtime_array = array_merge($cardtime_array, array("$i:AM" => "$i:AM"));
}
$cardtime_array = array_merge($cardtime_array, array("12:PM" => "12:PM"));
for ($i = 1; $i < 12; $i++) {
$cardtime_array = array_merge($cardtime_array, array("$i:PM" => "$i:PM"));
}
$option_value = $this->optionValueArray($cardtime_array, $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getYesNoCombo($option_name, $curVal) {
$yesno_array = [
'0' => 'No',
'1' => 'Yes'
];
$option_value = $this->optionValueArray($yesno_array, $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getCardPicturesCombo($option_name, $curVal) {
global $savvyext;
$storage = $savvyext->cfgReadChar('system.storage_url');
$sql = "SELECT '{$storage}cards/'||uniqueid||'.'||format AS id,"
. " id||' ['|| file_size*0.01 ||'kb] -{$storage}cards/'||uniqueid||'.'||format AS val FROM card_images";
$q = $this->db->query($sql);
$option_value = $this->optionValueObject($q->result(), "id", "val", $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getJobPostDuration($option_name, $duration) {
$this->defaultComboMessage = 'Select duration of post';
$cmbstr = "";
for ($ii = 2; $ii <= 10; $ii++) {
$cmbstr .= "<option value='$ii'>$ii day(s)</option>";
}
for ($ii = 2; $ii <= 5; $ii++) {
$days_c = $ii * 7;
$cmbstr .= "<option value='$days_c'>$ii Weeks</option>";
}
return $this->comboFrame($option_name, $cmbstr);
}
public function getUserJobGroupCombo($option_name, $member_id, $curVal) {
// $sql = "SELECT id,group_name FROM members_job_group WHERE member_id = $member_id AND status = 1 ORDER BY group_name ASC ";
$sql = "SELECT m.id,m.group_name, m.group_name||' ['||count(g.group_id)||' members]' AS member_group_count "
. "FROM members_job_group m "
. "LEFT JOIN members_job_groupmember g ON g.group_id = m.id "
. "WHERE m.member_id = $member_id "
. "AND m.status = 1 GROUP BY m.id,m.group_name ORDER BY m.group_name ASC";
$q = $this->db->query($sql);
$option_value = $this->optionValueObject($q->result(), "id", "member_group_count", $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getUserRecipientCombo($option_name, $member_id, $curVal) {
$sql = "SELECT b.id,b.firstname||' '||b.lastname||' '||b.account_no||' '||k.name AS recipient "
. "FROM sendmoney_recipient b "
. "LEFT JOIN bank_entity_codes k ON k.code=b.bank_code "
. "WHERE b.member_id = $member_id AND b.status=1";
$q = $this->db->query($sql);
$option_value = $this->optionValueObject($q->result(), "id", "recipient", $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getAccountTypeCombo($option_name, $curVal) {
$q = $this
->db
->where('status', 1)
->order_by('type_name', 'ASC')
->get('account_types');
$option_value = $this->optionValueObject($q->result(), "type_value", "type_name", $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getGeneralSkillCombo($option_name, $curVal) {
$this->showDefaultSelect = false;
$q = $this
->db
->where('status', 1)
->order_by('lorder', 'DESC')
->get('skill_category');
$option_value = $this->optionValueObject($q->result(), "id", "category", $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getUserNewSkillCombo($option_name, $curVal, $category_id, $member_id) {
$q = $this
->db
->where('status', 1)
->where('category_id', $category_id)
->order_by('lorder', 'DESC')
->get('skill_types');
$option_value = $this->optionValueObject($q->result(), "id", "skill", $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function setReadOnly($bl) {
$this->readOnlyMode = $bl;
}
public function getCountryCombo($option_name, $curVal) {
$q = $this
->db
->where('status', 1)
->order_by('country', 'ASC')
->get('country');
$option_value = $this->optionValueObject($q->result(), "code", "country", $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getTransportProvidersCombo($option_name, $curVal) {
$q = $this
->db
->where('active', 1)
->order_by('name', 'ASC')
->get('transport_providers');
$option_value = $this->optionValueObject($q->result(), "id", "name", $curVal);
return $this->comboFrame($option_name, $option_value);
}
private function optionValueArray($sdStd, $val) {
$this->optCons = '';
foreach ($sdStd as $key => $value) {
$selV = '';
if ($key == $val) {
$selV = " selected ";
}
$this->optCons .= "<option value='" . $key . "' " . $selV . ">" . $value . "</option>";
}
return $this->optCons;
}
private function optionValueObject($sdStd, $val, $valname, $curVal) {
$this->optCons = '';
if ($this->showDefaultSelect == true) {
$this->optCons .= "<option value='" . $this->defaultComboValue . "'>" . $this->defaultComboMessage . "</option>";
}
foreach ($sdStd as $row) {
$selV = '';
if ($curVal == $row->$val) {
$selV = " selected ";
}
$this->optCons .= "<option value='" . $row->$val . "' " . $selV . ">" . $row->$valname . "</option>";
}
return $this->optCons;
}
private function comboFrame($option_name, $option_value) {
$addReaOnly = "";
if ($this->readOnlyMode == true) {
$addReaOnly = " disabled ";
}
$combo_to_return = $cmb = "<select data-placeholder='" . $this->defaultComboMessage . "' class='" . $this->currentStyle . "' name='$option_name' id='$option_name' $addReaOnly >$option_value</select>";
$this->defaultComboMessage = "Select"; // house cleaning
$this->defaultComboValue = '';
return $combo_to_return;
}
public function getCardActionTypeCombo($option_name, $curVal) {
$options_array = [
'alert' => 'Show Alert',
'browser' => 'Open Browser',
'deeplink' => 'Open App via Deeplink',
'callback' => 'Call API'
];
$option_value = $this->optionValueArray($options_array, $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getTimezoneCombo($option_name, $curVal = null) {
$q = $this->db->get('address_timezone');
$option_value = $this->optionValueObject($q->result(), "id", "timezone", $curVal);
return $this->comboFrame($option_name, $option_value);
}
// put this function in the model and use for now for the Neighborhood combo
public function getCountryNeighborhoodCombo($option_name, $country, $cState, $curVal) {
$hood_array = [
'0' => 'Neighborhood 100',
'1' => 'Neighborhood 200',
'2' => 'Neighborhood 300',
'3' => 'Neighborhood 400',
'5' => 'Neighborhood 500',
'4' => 'Neighborhood 600',
'6' => 'Neighborhood 700'
];
$option_value = $this->optionValueArray($hood_array, $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getControllerCombo($option_name, $options_array, $curVal) {
$option_value = $this->optionValueArray($options_array, $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getPermissionLevel($option_name, $curVal) {
$sql = "SELECT * FROM bko_permission_level WHERE status=1 ";
$q = $this->db->query($sql);
$option_value = $this->optionValueObject($q->result(), "plevel", "name", $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getControllerAndMethodCombo($option_name, $options_array, $curVal) {
$option_value = $this->optionValueArray($options_array, $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getCityCombo($option_name, $curVal) {
$q = $this
->db
->order_by('city', 'ASC')
->get('geofence_area_city');
$option_value = $this->optionValueObject($q->result(), "id", "city", $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getGeofenceAreaCombo($option_name, $curVal) {
$q = $this
->db
->order_by('name', 'ASC')
->get('geofence_area');
$option_value = $this->optionValueObject($q->result(), "id", "name", $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getAccAndEmailCombo($option_name, $curVal) {
$array = [
'ALL' => 'ALL',
'ACC' => 'ACC',
'EMAIL' => 'EMAIL',
];
$option_value = $this->optionValueArray($array, $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getMsgStatusCombo($option_name, $curVal = null) {
$array = [
'' => 'ALL',
'1' => 'Pending',
'2' => 'Expired',
'3' => 'Cancelled',
'5' => 'Completed'
];
$option_value = $this->optionValueArray($array, $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getStatusComboWithAll($option_name, $curVal, $custom_options = []) {
$yesno_array = [
'-1' => 'ALL',
'0' => 'InActive',
'1' => 'Active'
];
if (!empty($custom_options)) {
foreach ($custom_options as $key => $val) {
if (array_key_exists($key ,$yesno_array)) {
$yesno_array[$key] = $val;
}
}
}
$option_value = $this->optionValueArray($yesno_array, $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getYesNoComboWithAll($option_name, $curVal) {
$yesno_array = [
'-1' => 'ALL',
'0' => 'No',
'1' => 'Yes'
];
$option_value = $this->optionValueArray($yesno_array, $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getStatusComboFromZeroToNine($option_name, $curVal) {
$status_array = range(0, 9);
$status_array['-1'] = 'ALL';
ksort($status_array);
$option_value = $this->optionValueArray($status_array, $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getStatusComboFromZeroToOne($option_name, $curVal) {
$status_array = range(0, 1);
$status_array['-1'] = 'ALL';
ksort($status_array);
$option_value = $this->optionValueArray($status_array, $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getCardImageCategoryCombo($option_name, $curVal) {
$q = $this->db
->order_by('description')
->get('card_image_category');
$option_value = $this->optionValueObject($q->result(), "id", "description", $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getCountryComboWithoutFilter($option_name, $curVal) {
$q = $this
->db
->order_by('country', 'ASC')
->get('country');
$option_value = $this->optionValueObject($q->result(), "code", "country", $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getQuoteSourceCombo($option_name, $curVal) {
$yesno_array = [
'' => 'All',
0 => 'Application',
1 => 'Automatic'
];
$option_value = $this->optionValueArray($yesno_array, $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getCompletedCombo($option_name, $curVal)
{
$yesno_array = [
'-1' => 'All',
'0' => 'Pending',
'1' => 'Complete'
];
$option_value = $this->optionValueArray($yesno_array, $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getCardActivityScreen($option_name, $curVal)
{
$opts = [];
for ($i = 1; $i <= 5; $i++) {
$opts[$i] = 'Screen ' . $i;
}
$option_value = $this->optionValueArray($opts, $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getCardShowArea($option_name, $curVal)
{
$opts = [
0 => 'Default',
1 => 'Main Feed Only',
2 => 'Activity Screen Only',
];
$option_value = $this->optionValueArray($opts, $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getScreenNames($option_name, $curVal)
{
$opts = [
'' => 'Select',
'activity-transactional-table' => 'activity-transactional-table',
'activity-monthly-spent' => 'activity-monthly-spent',
'activity-time-traveled' => 'activity-time-traveled',
'activity-emissions' => 'activity-emissions',
'activity-personality' => 'activity-personality',
];
$option_value = $this->optionValueArray($opts, $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getTriggerIds($option_name, $curVal)
{
$q = $this
->db
->order_by('e_trigger', 'ASC')
->get('email_trigger');
$option_value = $this->optionValueObject($q->result(), "e_trigger", "e_trigger", $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getCardExpiration($option_name, $curVal)
{
$opts = [
0 => 'Default',
100 => 'One time click',
];
$option_value = $this->optionValueArray($opts, $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getCountriesHasAccount($option_name, $curVal){
$sql = "SELECT code, country
FROM country
WHERE EXISTS (SELECT * FROM members WHERE country = country.code)
ORDER BY code ASC";
$vals = $this->db->query($sql)->result_array();
$opts = [
'' => '- All Countries -'
];
foreach ($vals as $val){
$opts[$val['code']] = ''.$val['code'].' - '.$val['country'];
}
$opts['unknown'] = 'unknown';
$option_value = $this->optionValueArray($opts, $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getPointKeyUsed($option_name, $curVal) {
$sql = "
SELECT mp.point_key, ps.name as point_name
FROM members_points mp
INNER JOIN points_settings ps ON ps.point_key = mp.point_key
WHERE mp.points > 0
GROUP BY mp.point_key, ps.name";
$vals = $this->db->query($sql)->result_array();
$opts = [
'' => '- All Point Keys -'
];
foreach ($vals as $val){
$opts[$val['point_key']] = $val['point_key'] . ' - ' . $val['point_name'];
}
$option_value = $this->optionValueArray($opts, $curVal);
return $this->comboFrame($option_name, $option_value);
}
public function getPointValueUsed($option_name, $curVal) {
$sql = "
SELECT points as point_value
FROM members_points mp
WHERE points > 0
GROUP BY points";
$vals = $this->db->query($sql)->result_array();
$opts = [
'' => '- All Point Value -'
];
foreach ($vals as $val){
$opts[$val['point_value']] = $val['point_value'];
}
$option_value = $this->optionValueArray($opts, $curVal);
return $this->comboFrame($option_name, $option_value);
}
}