how to add show data on modal for individual id? - codeigniter

I want when user click on "more detail href". they should get this detail on modal the box.
<ul class="list-tickets">
<?php foreach ($searchFlights as $searchFlight) {
//One Way Logic
$stopInfo_O = "";
$stopCount_O = 0;
$AirlineLogo_O = $this->search_model->getAirlinelogo($searchFlight->airline_idO);
$finalDepartdate_O = $searchFlight->departure_dateO;
$DepartAirpot_O = $this->search_model->getAirportCode($searchFlight->depart_airportidO);
$totalFlightTime_O = $searchFlight->total_flighttimeO;
$finalArrivaldate_O = $searchFlight->arrival_dateO;
$totalBaggage_O = $searchFlight->baggageO;
$stopOvertime1 = $searchFlight->stopover1_staydurationO;
$className0 = $searchFlight->classNameO;
$ArrivalAirpot_O = $this->search_model->getAirportCode($searchFlight->arrival_airportidO);
$flightPrice = $searchFlight->flightPrice;
if($searchFlight->operatedby_airlineidO == "0") {
$operatedAirlinename = "";
} else {
$operatedAirlinename = $this->search_model->getAirlinename($searchFlight->operatedby_airlineidO);
}
//Stops Handling Oneway
if(empty($searchFlight->stopover1_airportidO) && empty($searchFlight->stopover2_airportidO)){ $stopInfo_O = "Direct"; }
if($searchFlight->stopover1_airportidO != 0){ $stopCount_O++; }
if($searchFlight->stopover2_airportidO != 0){ $stopCount_O++; }
if($stopCount_O>0){
$stopInfo_O .= $stopCount_O." Stop ";
//Stop oneway 1
$stopInfo_O .= $this->search_model->getAirportCode($searchFlight->stopover1_airportidO);
if($stopCount_O == 2) {
//Stop One Way 2
$stopInfo_O .= ", ".$this->search_model->getAirportCode($searchFlight->stopover2_airportidO);
}
}
?>
<li class="list-item">
<div class="list-item-inner">
<div class="list-item-main">
<!-- Oneway Section -->
<div class="list-item-top">
<div class="list-item-logo">
<img src="<?= base_url(); ?>uploads/<?php echo $AirlineLogo_O; ?>" alt="">
</div>
<div class="list-item-content">
<div class="list-item-content-left">
<!-- Final Departure Dates-->
<div class="text-bold text-base">
<?php echo $finalDepartdate_O; ?>
</div>
<!-- Departure Airport -->
<span class="small reveal-block">
<?php echo $DepartAirpot_O; ?>
</span>
</div>
<div class="list-item-content-line-wrapper small">
<!-- Total Flight Time -->
<div class="list-item-content-line-top">
<?php echo $totalFlightTime_O; ?>
</div>
<div class="list-item-content-line"></div>
<!-- Stops info -->
<div class="list-item-content-line-bottom text-primary">
<p title="<?php echo $stopOvertime1; ?>"><?php echo $stopInfo_O; ?> </p>
</div>
</div>
<div class="list-item-content-right">
<!-- Final Arrival date -->
<div class="text-bold text-base">
<?php echo $finalArrivaldate_O; ?>
</div>
<!-- Arrival Airport -->
<span class="small reveal-block">
<?php echo $ArrivalAirpot_O; ?>
</span>
</div>
</div>
</div>
</div>
<div class="list-item-footer ticket-holder-dt">
<h5 class="text-bold list-item-price"><?php echo COMMON_CurrencySymbol." ".$flightPrice;?></h5>
<span class="ticket-include"></span>
<span class="ticket-type">One way</span>
<a class="btn btn-info btn-xs btn-no-shadow" href="<?= base_url(); ?>searchflights/bookFlight?id=<?php echo $searchFlight->id; ?>">
Book Now
</a>
<br>
<a href="">
More detail <!-- I want when user click on it. they should get this detail on modal the box -->
</a>
<br>
<?php echo $className0; ?> Class
</div>
</div>
<div class="small text-gray-light list-item-subtitle">Operated by <?php echo $operatedAirlinename; ?></div>
<div class="tripbaggage">Baggage: <?php echo $totalBaggage_O; ?></div>
<?php } ?>

You can achieve this by implementing separate modal for each id inside for loop or
by implementing Ajax request to show the detail information of the corresponding id.

Related

Can't make carousel work in php: CodeIgniter

I have added a carousel in a container but it remains static showing the first pic. Though the carousel buttons are visible but not active. The code is:
<div class="col-xl-8 col-lg-8 col-md-7 mb-5 mb-md-0">
<div id="" class="pt-0 pt-md-4 pt-lg-5">
<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<?php if (!empty($event)) {
foreach ($event as $key => $value) {
?>
<li data-target="#carouselExampleIndicators" data-slide-to="<?= $key ?>" <?php if ($key == 0) { ?> class="active" <?php } ?>></li>
<?php }
} ?>
</ol>
<div class="carousel-inner">
<?php if (!empty($event)) {
foreach ($event as $key => $value) {
$date = date('d', strtotime($value['datetime']));
$month = date('F', strtotime($value['datetime']));
$year = date('Y', strtotime($value['datetime']));
$seconds = strtotime($value['datetime']) - time();
$days = floor($seconds / 86400);
$seconds %= 86400;
$hours = floor($seconds / 3600);
$seconds %= 3600;
$minutes = floor($seconds / 60);
$seconds %= 60;
$cdate = date("Y-m-d H:i:s", strtotime($value['datetime']));
if ($cdate > date("Y-m-d H:i:s")) {
?>
<div class="carousel-item <?php if ($key == 0) { ?>active<?php } ?>">
<div class="row">
<div class="col-md-12 col-lg-6 mb-4 mb-md-0">
<div class="d-flex align-items-center justify-content-between w-100">
<!--<div class="images-craus">-->
<!-- <img src="<?= base_url() ?>/images/upcomingevents/<?= $value['image1'] ?>">-->
<!--</div>-->
<div class="dates">
<h3 class="months"><?= $month ?> <?= $date ?><br><?= $year ?></h3>
<h3 class="team"><?= $cdate ?> <br><?= $value['team1'] ?> vs <?= $value['team2'] ?></h3>
</div>
<!--<div class="images-craus">-->
<!-- <img src="<?= base_url() ?>/images/upcomingevents/<?= $value['image2'] ?>">-->
<!--</div>-->
</div>
</div>
<div class="col-md-12 col-lg-6 mb-4 mb-md-0">
<div class="details1">
<div class="pt-0 pt-md-4 pb-3">
<h5 class="text-white text-center">Next Match<br><?= $value['team1'] ?> vs <?= $value['team2'] ?></h5>
</div>
<div class="button-20 d-flex">
<button type="button" class="btn btn-danger"><?= $days ?> day</button>
<button type="button" class="btn btn-danger"><?= $hours ?> hr</button>
<button type="button" class="btn btn-danger"><?= $minutes ?>min</button>
</div>
</div>
</div>
</div>
</div>
<?php }
}
} ?>
</div>
I tried looking at bootstrap feature but couldn't really work it out. Mind you this carousel also have a table list which shows on the right side of the container. I am not sharing it code as table is working fine.

if click default button address should be default

One user multiple shipping address how to make it as default,if click the make as default button,that address should be default and remaining all address shown the make as default button in a particular address box,except default address box.
view page
<?php foreach ($buyer_Address as $row) { ?>
<div class="col-md-4">
<div class="panel panel-default add_min_height">
<div class="panel-heading">Default:</div>
<input type="hidden" name="de" id="de" value="<?php echo $row->b_id; ?>">
<div class="panel-body">
<address><?php echo $row->b_fullname; ?><br>
<?php echo $row->b_street_address; ?>,<?php echo $row->b_locality ?>,<br>
<?php echo $row->b_landmark; ?>,
<?php echo $row->b_city; ?>, <?php echo $row->b_state; ?>,<?php echo $row->b_pincode; ?>
India
Phone number: <?php echo $row->b_mobile_number; ?></address>
</div>
<div class="panel-footer">
<a href="<?php echo base_url(); ?>index.php/welcome/buyereditaddress?id=<?php echo $row->b_id; ?>" >Edit</a>
<i class="fa fa-ellipsis-v"></i>
Delete
<i class="fa fa-ellipsis-v"></i>
<?php if ($row->status == '0') { ?>
<button type="submit" style="color:#337ab7;background: none !important;border: none;" name="default" id="default">Make as deafault</button>
<?php } ?>
</div>
</div>
</div>
<?php } ?>
controller
public function defaultAddress() {
$id = $this->input->post('de');
$this->BuyerProfile_Model->defaultAddress($id);
redirect('welcome/buyeraddresses');
}
model
function defaultAddress($id) {
$this->db->trans_start();
$this->db->query("UPDATE buyer_order_address SET status = '0' WHERE b_id = '$id'");
$this->db->query("UPDATE buyer_order_address SET status = '1' WHERE b_id = '$id'");
$this->db->trans_complete();
}

clicking menu error does not show the page

What is the difference between:
http://localhost/gsa/profile/history --> (offline)
and
http://www.gsa-constructionspecialist.com/profile/history (online)
Offline shows:
Not Found
The requested URL /gsa/profile/history was not found on this server.
After clicking this menu:
views/0hearder.php
<div id="menu">
<h3 class="listmenu" data="1" data-title="home">Home</h3>
<h3 class="listmenu" data="2" data-title="profile">Home</h3>
<div class="submenu2" style="display:none">
<?php
$profile = $this->post_model->post(1);
if ($profile){
foreach ($profile as $pro){
?>
<h3 class="submenu" style="<?php echo ($this->uri->segment(2)==$pro->post_alias)?'font-weight:bold':''; ?>"><?php echo $pro->post_title; ?></h3>
<?php } } ?>
</div>

codeigniter invalid argument supplied for foreach() on join clause

i try all of away that i know and suggestion on internet.
but all time return false.
please help me...
thanks
my error message is:
Severity: Warning
Message: Invalid argument supplied for foreach()
Filename: views/index.php
Line Number: 10
model.php
public function getBanner()
{
$this->db->select('album.id, album.cat_id , album.poster, album.slug, album.modify, category.id, category.name, category.slug');
$this->db->from('album,category');
$this->db->where('album.cat_id', 'category.id');
$query = $this->db->get();
if($query->num_rows() != 0)
{
$result = $query->result_array();
return $result;
}
else
{
return false;
}
}
controllers.php
$data['banner'] = $this->Fornt_model->getBanner();
showbanner.php
<section class="banner">
<div class="container">
<div class="row">
<div class="col-sm-12">
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<?php $item = 1; foreach($banner as $latest_poster): $item_class = ($item == 1) ? 'item active' : 'item'; ?>
<div class="<?php echo $item_class; ?>">
<img src="<?php echo base_url('images/poster/'.$latest_poster['poster']); ?>" class="img-responsive img-thumbnail">
<div class="carousel-caption caption">
<a href="<?php echo site_url('category/bollywood/'.$latest_poster['slug']); ?>" class="box">
<b class="h3"><?php echo $latest_poster['name']; ?></b>
<small class="p">Exclusive AT*<?php echo substr($latest_poster['modify'], 0, 10); ?></small>
</a>
</div>
</div>
<?php $item++; endforeach; ?>
</div>
</div>
</div>
</div>
<div class="clearfix" style="padding: 10px 0;"></div>
<div class="row hidden-xs">
<?php $itemto = 0; foreach($banner as $latest_poster): $item_class_active = ($itemto == 0) ? 'active' : ''; ?>
<div class="col-sm-2 pointer" data-target="#myCarousel" data-slide-to="<?php echo $itemto; ?>"><img src="<?php echo base_url('images/poster/'.$latest_poster['poster']); ?>" class="img-responsive img-thumbnail" /></div>
<?php $itemto++; endforeach; ?>
</div>
</div>
I think something wrong with your query.. try
if($query->num_rows() != 0)
{
$result = $query->result_array();
print_r($result);
}
make sure your array data is available..
If there is no rows, front_model->getBanner() will return the result as false. Due to this you are getting an error. Use following code
public function getBanner()
{
$this->db->select('album.id, album.cat_id , album.poster, album.slug, album.modify, category.id, category.name, category.slug');
$this->db->from('album,category');
$this->db->where('album.cat_id', 'category.id');
$query = $this->db->get();
return $query->result_array();
}

http://ajobis.brainiacstech.com/404_override error when i pass url

http://ajobis.brainiacstech.com/404_override error when i pass url
when i click on apply button to send action url this message shown is 404 page not found i think it is because of use of () brakets with test work, other url which has no any special charachter is being passed successfully, my code is as under
<div id="content-wrapper" class="container">
<div class="row">
<div class="col-lg-9">
<div>
<div class="content-wrapper">
<!-- <div class="content-header">
<script>
function goBack() {
window.history.back()
}
</script>
<div class="title"><h1><a onclick="goBack()"><img src="<?php echo base_url("resources/images/back-icon.jpg"); ?>" alt="">Back to Results</a></h1></div>
</div>-->
<div class="content">
<div id="search-result-wrapper">
<div class="title" style="color: #005580;"><h1><?php echo $job->job_title; ?></h1></div>
<div>
<p><?php echo $job->job_description; ?></p>
</div>
<?php if (!empty($job->question)) { ?>
<div class="title text-blue"><h2>Application Questions</h2></div>
<div class="question-awnser">
<ul>
<?php $counter = 0; ?>
<?php foreach ($job->question as $question) { ?>
<li><?php echo $question->question;
$counter++; ?>
<span class="answers">
<input type="radio" name="answers" id="yes" value="yes">
<label id="answer_<?php echo $counter; ?>" for="yes">Yes</label>
/
<input type="radio" name="answers" id="no" value="No">
<label for="no">No</label>
</span>
</li>
<?php } ?>
</ul>
</div>
<?php } ?>
<div class="section-row">
<div class="pull-right">
<div class="pull-left">
<img src="<?php echo base_url("resources/images/apply-icon.jpg"); ?>"> Apply
</div>
<div class="pull-left" id="<?php echo $job->id; ?>">
<button onclick="save_job('<?php echo $job->id; ?>')" class="btn btn-blue"><span class="glyphicon glyphicon-save"></span> Save</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php $this->load->view('front/common/job_detail_widget'); ?>
</div>
<div class="row">
<div class="col-lg-11">
<div class="title"><h3 style="color: #0a0;">Suggested Jobs</h3></div>
</div>
</div>
<div class="suggestion-jobs"><div class="row">
<!--suggestedJobs-->
<?php if (!empty($suggestedJobs)) { ?>
<?php foreach ($suggestedJobs as $suggestedJob) { ?>
<div class="col-lg-3 suggestions">
<input type="text" id="jobid" value="<?php echo $suggestedJob->job_url; ?>" style="display: none;">
<input type="text" id="jobid" value="<?php echo $suggestedJob->id; ?>" style="display: none;">
<div class="suggestions-info"><h4><?php echo $suggestedJob->job_title; ?></h4></div>
<div class="suggestions-info"><span>Salary: </span><?php echo $suggestedJob->min_salary; ?> - to - <?php echo $suggestedJob->max_salary; ?></div>
<div class="suggestions-info"><span>Location: </span><?php echo $suggestedJob->location; ?></div>
<div class="suggestions-info"><span>Posted on: </span><?php echo $suggestedJob->start_date; ?></div>
</div>
<?php } ?>
<?php } else { ?>
No Job Found
<?php } ?>
</div>
</div>
</div><!--
<!--</div>-->
<script src="<?php echo base_url("resources/js/icheck.js"); ?>"></script>
<script type="text/javascript">
function save_job(id) {
$.ajax({
dataType: 'json',
type: 'POST',
url: base_url + 'employee/add-to-favorite',
data: {
jobId: id
},
success: function(RESP) {
if (RESP.status == 200) {
$('#' + id).html("<button class='btn btn-green' disabled='disabled'><span class='glyphicon glyphicon-save'></span> Saved</button>");
displayUIMessage(RESP.message);
}
}
});
}
function check_killer_answers() {
var count = '<?php echo $counter; ?>';
var error = 0;
for (var i = 1; i <= count; i++) {
if ($('#answer_' + i).hasClass('active')) {
} else {
error++;
}
}
if (error == 0) {
window.location.href = '<?php echo base_url('employee/confirm-apply/' . #$job->job_url); ?>';
} else {
alert('Please answer all questions to apply.');
}
}
function report(id) {
$.ajax({
dataType: 'json',
type: 'POST',
url: base_url + 'employee/report-to-admin',
data: {
jobId: id
},
success: function(RESP) {
if (RESP.status == 200) {
displayUIMessage(RESP.message);
}
}
});
}
</script>

Resources