I am total newbie but I am trying to modify this script:
public function fetchProducts($syncAll = true)
{
$this->library = new B1([
'apiKey' => $this->settings->get('api_key'),
'privateKey' => $this->settings->get('private_key')
]);
$i = 0;
$enableQuantitySync = $this->settings->get('quantity_sync');
$enableSyncItemName = $this->settings->get('sync_item_name');
$enableSyncItemPrice = $this->settings->get('sync_item_price');
$this->items->resetAllB1ReferenceId();
$page = 0;
$warehouseId = 7;
$data = [];
do {
$i++;
try {
$response = $this->library->request('e-commerce/items/stock', [
'warehouseId' => $warehouseId,
'page' => ++$page,
'pageSize' => 100,
'filters' => [
'groupOp' => 'AND',
'rules' => [
],
],
]);
$data = $response->getContent();
foreach ($data['data'] as $item) {
if ($item['code'] != NULL) {
$this->items->updateProductReferenceId($item['id'], $item['code']);
if ($enableQuantitySync == 1) {
$this->items->updateProductQuantity2($item['quantity'], $item['id']);
}
if ($enableSyncItemName == 1) {
$this->items->updateItemName($item['name'], $item['id']);
}
if ($enableSyncItemPrice == 1) {
$this->items->updateItemPrice($item['priceWithoutVat'], $item['id']);
}
}
}
} catch (B1Exception $e) {
$content = $e->getResponse()->getContent();
$this->helper->printPre($content['message']);
} catch (B1DuplicateException $e) {
$content = $e->getResponse()->getContent();
$this->helper->printPre($content['message']);
} catch (B1DuplicateException $e) {
$content = $e->getResponse()->getContent();
$this->helper->printPre($content['message']);
} catch (B1ValidationException $e) {
$content = $e->getResponse()->getContent();
$this->helper->printPre($content['message']);
} catch (B1ResourceNotFoundException $e) {
$content = $e->getResponse()->getContent();
$this->helper->printPre($content['message']);
} catch (B1InternalErrorException $e) {
$content = $e->getResponse()->getContent();
$this->helper->printPre($content['message']);
}
echo "$i;";
} while (isset($data['pages']) && $page <= $data['pages'] && $i < self::MAX_ITERATIONS);
echo 'OK';
}
This script works fine, but I want to add another warehouse id = 2 in this function, so I am trying add this piece of code inside of function:
$warehouseId = 2;
$data = [];
do {
$i++;
try {
$response = $this->library->request('e-commerce/items/stock', [
'warehouseId' => $warehouseId,
'page' => ++$page,
'pageSize' => 100,
'filters' => [
'groupOp' => 'AND',
'rules' => [
],
],
]);
$data = $response->getContent();
foreach ($data['data'] as $item) {
if ($item['code'] != NULL) {
$this->items->updateProductReferenceId2($item['id'], $item['code']);
if ($enableQuantitySync == 1) {
$this->items->updateProductQuantity2($item['quantity'], $item['id']);
}
if ($enableSyncItemName == 1) {
$this->items->updateItemName2($item['name'], $item['id']);
}
if ($enableSyncItemPrice == 1) {
$this->items->updateItemPrice2($item['priceWithoutVat'], $item['id']);
}
}
}
}
But I am getting errors.
Can someone help me to figure out a solution for this?
I was trying to add selected code in the function, but I am getting errors.
Related
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class index extends BaseController
{
public function __construct()
{
parent::__construct();
$this->load->model('P_pmb', 'p_pmb');
}
public function index()
{
$data['title'] = 'Dashboard';
$this->render('index/index', $data);
}
public function pendaftarprodi1()
{
$data['title'] = 'Grafik Berdasarkan Prodi 1';
$prodi = $this->p_pmb->listProdi();
foreach ($prodi as $key => $p) {
$prodi[$key]['jumlah'] = $this->p_pmb->jumlahPendaftarProdi1($p['id_prodi']);
$prodi[$key]['jumlah2'] = $this->p_pmb->jumlahPendaftarProdi2($p['id_prodi']);
$prodi[$key]['size'] = rand(10, 30);
}
//grafik 1
$result = null;
foreach ($prodi as $p => $prod) {
// if ($prod['jumlah'] > $sum) {
// $sum = $prod['jumlah'];
// $sliced = true;
// $selected = true;
// }
$result[$p] = [
"name" => $prod['nama_prodi'],
"jumlah" => $prod['jumlah'],
"y" => $prod['size'],
// "sliced" => $sliced,
// 'selected' => $selected
];
}
$data['pendaftar'] = $prodi;
$data['grafik1'] = json_encode($result);
$this->render('index/grafik1', $data);
}
public function pendaftarprodi2()
{
$data['title'] = 'Grafik Berdasarkan Prodi 2';
$prodi = $this->p_pmb->listProdi();
foreach ($prodi as $key => $p) {
$prodi[$key]['jumlah'] = $this->p_pmb->jumlahPendaftarProdi1($p['id_prodi']);
$prodi[$key]['jumlah2'] = $this->p_pmb->jumlahPendaftarProdi2($p['id_prodi']);
$prodi[$key]['size'] = rand(10, 30);
}
//grafik 2
$hasil = null;
foreach ($prodi as $p => $prod) {
$hasil[$p] = [
"name" => $prod['nama_prodi'],
"jumlah" => $prod['jumlah2'],
"y" => $prod['size'],
// "sliced" => $sliced,
// 'selected' => $selected
];
}
$data['pendaftar'] = $prodi;
$data['grafik2'] = json_encode($hasil);
$this->render('index/grafik2', $data);
}
public function pendaftarprestasi()
{
$pendaftarprestasi = $this->p_pmb->listpendaftarprestasi();
foreach ($pendaftarprestasi as $key => $p) {
$pendaftarprestasi[$key]['jumlah'] = $this->p_pmb->jumlahpendaftarprestasi($p['tingkat_prestasi']);
$pendaftarprestasi[$key]['size'] = rand(10, 30);
}
$result = null;
$sum = 0;
foreach ($pendaftarprestasi as $p => $pendpres) {
//if ($pendpres['jumlah'] > $sum) {
// $sum = $pendpres['jumlah'];
// $sliced = true;
// $selected = true;
// }
$result[$p] = [
"name" => $pendpres['tingkat_prestasi'],
'jumlah' => $pendpres['jumlah'],
'y' => $pendpres['size'],
// $sliced => $sliced,
// $selected => $selected
];
}
$data['pendaftarprestasi'] = $pendaftarprestasi;
$data['grafikprestasi'] = json_encode($result);
$this->render('index/grafikprestasi', $data);
}
public function jalurmasuk()
{
$pendaftar = $this->p_pmb->listjalurpendaftar();
foreach ($pendaftar as $key => $p) {
$pendaftar[$key]['jumlah'] = $this->p_pmb->jumlahjalurpendaftar($p['nama_jalur']);
$pendaftar[$key]['jumlah'] = rand(10, 30);
}
$result = null;
$sum = 0;
foreach ($pendaftar as $p => $jalmask) {
//if ($jalmask['jumlah'] > $sum) {
// $sum = $jalmask['jumlah'];
// $sliced = true;
// $selected = true;
// }
$result[$p] = [
"name" => $jalmask['nama_jalur'],
'jumlah' => $jalmask['jumlah'],
'y' => $jalmask['jumlah'],
// $sliced => $sliced,
// $selected => $selected
];
}
$data['jalur_masuk'] = $jalmask;
$data['grafikmasuk'] = json_encode($result);
$this->render('index/grafikmasuk', $data);
}
public function pendapatan()
{
$data['title'] = 'Grafik Pendapatan Berdasarkan Bank';
$bank = $this->p_pmb->listBank();
$pendaftar = $this->p_pmb->pendaftarBank();
$categories = null;
$lunas = null;
$belum_lunas = null;
$sumTotal = 0;
foreach ($bank as $i => $b) {
$categories[] = $b['bank'];
foreach ($pendaftar as $key => $value) {
if ($b['id_bank'] == $value['id_bank']) {
if ($value['is_bayar'] == '1') {
$sumTotal += intval($value['total']);
$lunas[] = intval($value['total']);
} else {
$belum_lunas[] = intval($value['total']);
}
}
}
}
$result[] = [
'name' => 'Pendapatan',
'data' => $lunas,
];
$data['subtitle'] = 'Total Pendapatan Rp.' . $sumTotal;
$grafik['id_bank'] = json_encode($result);
$grafik['categories'] = json_encode($categories);
$data['grafikpendapatan'] = $grafik;
$this->render('index/grafikpendapatan', $data);
}
public function bank()
{
$data['title'] = 'Grafik Pendapatan Berdasarkan Bank';
$bank = $this->p_pmb->listBank();
$pendaftar = $this->p_pmb->pendaftarBank();
$categories = null;
$lunas = null;
$belum_lunas = null;
$sumTotal = 0;
foreach ($bank as $i => $b) {
$categories[] = $b['bank'];
foreach ($pendaftar as $key => $value) {
if ($b['id_bank'] == $value['id_bank']) {
if ($value['is_bayar'] == '1') {
$sumTotal += intval($value['total']);
$lunas[] = intval($value['total']);
} else {
$sumTotal += $value['jumlah'];
$belum_lunas[] = intval($value['total']);
}
}
}
}
$result[] = [
'name' => 'Lunas',
'data' => $lunas,
];
$result[] = [
'name' => 'Belum Lunas',
'data' => $belum_lunas,
];
$data['subtitle'] = 'Total Pendaftar: ' . $sumTotal;
$data['id_bank'] = $bank;
$data['grafikbank'] = json_encode($result);
$this->render('index/grafikbank', $data);
}
}
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class BaseController extends CI_Controller
{
public function render($filename, $data)
{
$this->load->view('template/app_top', $data);
$this->load->view('template/template_scripts', $data);
$this->load->view($filename, $data);
$this->load->view('template/app_bottom', $data);
}
}
I'm looking for the way to combine 2 foraech loops into one (merge 2 functions):
The result function should return both: ($is - boolean & $d - array).
Traversable data in both functions - the same.
Is it possible? What will be a good solution for that?
public function func1($p, $c) {
$is = 0;
if (!empty($p)) {
foreach($p as $k=>$v) {
if ((!empty($c['prod']) && $c['prod'] == $v['ref'] && $c['status'])) {
$is = 1;
break;
}
}
}
return $is;
}
public function func2($p) {
$d = [];
if (!empty($p)) {
foreach($p as $k=>$v) {
$prod = [
'name' => $v['name'],
'price' => $v['price'],
'reference' => $v['ref']
];
$d[] = $prod;
}
}
return $d;
}
Thanks.
My take, but not tested.
public function func3($p, $c) {
$is = 0;
$d = [];
if (!empty($p)) {
foreach($p as $k=>$v) {
$d[] = [
'name' => $v['name'],
'price' => $v['price'],
'reference' => $v['ref']
];
if ($is === 0 && (!empty($c['prod']) && $c['prod'] == $v['ref'] && $c['status'])) {
$is = 1;
}
}
}
return [$is, $d];
}
My question is regarding the use of the file system as a database to simply hold JSON files.
I have came up with this following code, not perfect at all. which I found very easy to store and extract data, using JSON files.
My question is, will this DB be good for any large projects? will it work fast? or is the limitation to use this kind of approach is simply security related?
Is there some kind of built-in solution by PHP for this kind of things?
Any input on this matter from people who know will be appreciated...
class JDB{
public $path;
function JDB( $path = __DIR__.'/jdb/' ){
$this->path = $path;
if( !file_exists($this->path) ) mkdir($this->path);
}
function p($t){
return $this->path.$t.'.json';
}
function get($t){
return json_decode(file_get_contents( $this->p($t) ));
}
function set($t,$c){
return file_put_contents( $this->p($t), json_encode($c,JSON_PRETTY_PRINT) );
}
function create( $t, $d = [] ){
$s = file_put_contents( $this->p($t), json_encode($d) );
return $s;
}
function destroy(){
$files = glob($this->path.'*'); // get all file names present in folder
foreach($files as $file){ // iterate files
if(is_file($file))
unlink($file); // delete the file
}
}
function delete( $t ){
$s = unlink( $this->p($t) );
return $s;
}
function insert( $t, $d = null ){
if($d) $d['__uid'] = $t.'_'.$this->uid();
$c = $this->get($t);
array_push($c,$d);
$s = $this->set($t,$c);
if($s) return $d['__uid'];
}
function update($t,$conditions,$u){
$c = $this->get($t);
$this->search($c,$conditions,function($object) use (&$c,$u){
foreach ($u as $key => $value) {
$object->$key = $value;
}
});
$this->set($t,$c);
}
function remove($t,$conditions){
$c = $this->get($t);
$this->search($c,$conditions,function($object,$key) use (&$c){
unset($c[$key]);
});
$this->set($t,$c);
}
function search( $c, $conditions = [], $fn ){
$l = count($conditions);
foreach ($c as $key => $object) {
$f = 0;
foreach ($conditions as $k => $v) {
if( property_exists($object,$k) && ($object->$k == $v) ){
$f++;
if( $f==$l ) $fn($object,$key);
}else break;
}
}
}
function select( $t, $conditions = [] ){
$c = $this->get($t);
$r = [];
$this->search($c,$conditions,function($object) use (&$r){
array_push($r,$object);
});
if (count($r) == 0) return false;
if (count($r) == 1) return $r[0];
return $r;
}
function count($t){
$c = $this->get($t);
return count($c);
}
function uid($length = 20) {
$c = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$cl = strlen($c);
$uid = '';
for ($i = 0; $i < $length; $i++) {
$uid .= $c[rand(0, $cl - 1)];
}
return $uid;
}
}
very simple, the question if this is even possible...
How To Use
$db = new JDB();
$db->create('users');
$db->create('pages');
$user_uid = $db->insert('users',[
'name' => 'a',
'password' => 'hello world',
'pages' => []
]);
$user_uid = $db->insert('users',[
'name' => 'b',
'password' => 'hello world',
'pages' => []
]);
$page_uid = $db->insert('pages',[
'name' => 'page 1',
'content' => 'hello world',
'users' => [$user_uid]
]);
$user = $db->select('users',['name' => 'a']);
$page = $db->select('pages',['users' => [$user_uid]]);
$db->update('users',['name' => 'b'],['pages' => [$page->__uid]]);
$db->remove('users',['name' => 'a']);
i have two tables
subscribed
categorys
public function get_categories($user_id)
{
$categories = $this->ApiModel->categories();
$subscribed = $this->ApiModel->get_categories($user_id);
$subscribed = explode(',', $subscribed->categorys);
foreach($categories as $category)
{
foreach($subscribed as $sub)
{
if($category->category == $sub)
{
$status = 'true';
}
else
{
$status = 'false';
}
}
$data = array('id' => $user_id, 'name' => $category->category, 'is_subscribed' => $status);
echo json_encode($data);
}
}
the result i m getting is
{"id":"3","name":"News","is_subscribed":"false"}{"id":"3","name":"Movies","is_subscribed":"true"}{"id":"3","name":"Sports","is_subscribed":"false"}{"id":"3","name":"Music","is_subscribed":"false"}
how to get all the subscribed category to b true
All you need to do is add a break; when you find a match in the inner loop. It will also speed up the processing.
public function get_categories($user_id)
{
$categories = $this->ApiModel->categories();
$subscribed = $this->ApiModel->get_categories($user_id);
$subscribed = explode(',', $subscribed->categorys);
$data = array();
foreach($categories as $category){
foreach($subscribed as $sub){
if($category->category == $sub){
$status = 'true';
break; //<-- new line
} else {
$status = 'false';
}
}
//$data = array('id' => $user_id, 'name' => $category->category, 'is_subscribed' => $status);
$data[] = array('id' => $user_id, 'name' => $category->category, 'is_subscribed' => $status);
//echo json_encode($data);
}
echo json_encode($data);
}
Is there any maximal length of controller class in codeigniter?
for me one controller wasn't working but when i deleted some lines the same code started working . anyone know whats going on ?
working code :
<?php
if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
class C_Object_details extends CI_Controller {
function __construct() {
parent::__construct();
respoti_profiler();
$this->load->library('session');
$this->load->model('m_object_details');
$this->params['set_tag'] = array();
$this->params['title_auto'] = true;
}
protected function convert_meta_results($result_meta) {
$meta_list = array();
foreach ($result_meta as $value) {
$meta_list[$value['meta_key']] = $value['meta_value'];
}
return $meta_list;
}
public function index() {
$id = (int) $this->uri->segment(2);
$object = $this->m_object_details->get_object($id);
if (empty($object)) {
show_404(sprintf('Brak obiektu o id: %s', $id));
}
$result_meta = $this->m_object_details->get_object_meta($id);
$meta_list = $this->convert_meta_results($result_meta);
unset($result_meta);
$rooms = array();
if ($object['post_url'] === 'hotel') {
$room_list = $this->m_object_details->get_room_list($object['post_code']);
foreach ($room_list as $key => $val) {
$where_in[] = $val['room_id'];
}
/* pobranie danych meta pokoi */
$room_meta_list = $this->m_object_details->get_room_meta($where_in);
foreach ($room_meta_list as $key => $value) {
$rooms[$value['metaroom_room_id']]['meta'][$value['metaroom_key']] = $value['metaroom_value'];
}
foreach ($room_list as $key => $val) {
$rooms[$val['room_id']]['room'] = $val;
}
unset($room_list, $room_meta_list);
}
//wygenerowanie listy atrybutow pokoi
$rooms_pref = array();
foreach ($rooms as $value) {
if (isset($value['meta'])) {
foreach ($value['meta'] as $key1 => $value) {
if (strpos($key, 'pref-') === false) {
continue;
}
$rooms_pref[$key1] = $value;
}
}
}
## OPINIE ##
$count = 0;
$opinia = 0;
$arr_opinion = array();
if (isset($meta_list['obj_booking_opinion'])) {
$arr_opinion[] = $meta_list['obj_booking_opinion'];
}
if (isset($meta_list['obj_google_opinion'])) {
$arr_opinion[] = $meta_list['obj_google_opinion'];
}
if (isset($meta_list['obj_hrs_opinion'])) {
$arr_opinion[] = $meta_list['obj_hrs_opinion'];
}
if (isset($meta_list['obj_ta_opinion'])) {
$arr_opinion[] = $meta_list['obj_ta_opinion'];
}
foreach ($arr_opinion as $value) {
$tmp_value = 0 + ( str_replace(',', '.', $value) );
if ($tmp_value > 0) {
$count++;
$opinia += $tmp_value;
}
}
if ($count === 0) {
$opinia = 0;
} else {
$opinia = round($opinia / $count, 1);
}
if ($opinia < 10) {
$opinia = number_format($opinia, 1, '.', '');
}
$arr_opinioncount = array();
if (isset($meta_list['obj_booking_opinioncount'])) {
$arr_opinioncount[] = $meta_list['obj_booking_opinioncount'];
}
if (isset($meta_list['obj_hrs_opinioncount'])) {
$arr_opinioncount[] = $meta_list['obj_hrs_opinioncount'];
}
if (isset($meta_list['obj_google_opinioncount'])) {
$arr_opinioncount[] = $meta_list['obj_google_opinioncount'];
}
if (isset($meta_list['obj_ta_opinioncount'])) {
$arr_opinioncount[] = $meta_list['obj_ta_opinioncount'];
}
$ilosc_opini = 0;
foreach ($arr_opinioncount as $value) {
$ilosc_opini += $value;
}
## KONIEC OPINI ##
## LINKI DO GALERI ##
$link_thumb = 'http://exifex.pl/system/uploads/300/';
$link_full = 'http://exifex.pl/system/uploads/';
$gallery_thumb = glob(sprintf("/home/respoti/domains/exifex.pl/public_html/system/uploads/300/%s*", $object['post_code']));
$gallery_full = glob(sprintf("/home/respoti/domains/exifex.pl/public_html/system/uploads/%s*", $object['post_code']));
## KONIEC LINKI DO GALERII ##
## hotele wyciag
if (isset($meta_list['attraction_price'])) {
$atr_price = $meta_list['attraction_price'];
} else
$atr_price = null;
if (isset($meta_list['rest_pricerange'])) {
$rest_price_range = $meta_list['rest_pricerange'];
} else {
$rest_price_range = null;
}
//dodane dzis
if (isset($meta_list['attraction_eventsorganized'])) {
$attr_type = $meta_list['attraction_eventsorganized'];
} else {
$attr_type = null;
}
if (isset($meta_list['rest_openhoursrange_start'])) {
$pn_pt = $meta_list['rest_openhoursrange_start'];
} else {
$pn_pt = null;
}
if (isset($meta_list['rest_openhoursrange_end'])) {
$pn_pt_e = $meta_list['rest_openhoursrange_end'];
} else {
$pn_pt_e = null;
}
if (isset($meta_list['rest_openhoursweekend_start'])) {
$pt = $meta_list['rest_openhoursweekend_start'];
} else {
$pt = null;
}
if (isset($meta_list['rest_openhoursweekend_end'])) {
$pt_e = $meta_list['rest_openhoursweekend_end'];
} else {
$pt_e = null;
}
if (isset($meta_list['rest_openhourssunday_start'])) {
$sun = $meta_list['rest_openhourssunday_start'];
} else {
$sun = null;
}
if (isset($meta_list['rest_openhourssunday_end'])) {
$sun_e = $meta_list['rest_openhourssunday_end'];
} else {
$sun_e = null;
}
if (isset($meta_list['nightlife_openhourssunday_start'])) {
$n_sun = $meta_list['nightlife_openhourssunday_start'];
} else {
$n_sun = null;
}
if (isset($meta_list['nightlife_openhourssunday_end'])) {
$n_sun_e = $meta_list['nightlife_openhourssunday_end'];
} else {
$n_sun_e = null;
}
if (isset($meta_list['nightlife_openhoursweekend_start'])) {
$n_pt = $meta_list['nightlife_openhoursweekend_start'];
} else {
$n_pt = null;
}
if (isset($meta_list['nightlife_openhoursweekend_end'])) {
$n_pt_e = $meta_list['nightlife_openhoursweekend_end'];
} else {
$n_pt_e = null;
}
if (isset($meta_list['nightlife_openhoursrange_start'])) {
$n_pn_pt = $meta_list['nightlife_openhoursrange_start'];
} else {
$n_pn_pt = null;
}
if (isset($meta_list['nightlife_openhoursrange_end'])) {
$n_pn_pt_e = $meta_list['nightlife_openhoursrange_end'];
} else {
$n_pn_pt_e = null;
}
if (isset($meta_list['nightlife_open_1_start'])) {
$pn_1 = $meta_list['nightlife_open_1_start'];
} else
$pn_1 = null;
if (isset($meta_list['nightlife_open_1_end'])) {
$pn_2 = $meta_list['nightlife_open_1_end'];
} else
$pn_2 = null;
if (isset($meta_list['nightlife_open_2_start'])) {
$wt_1 = $meta_list['nightlife_open_2_start'];
} else
$wt_1 = null;
if (isset($meta_list['nightlife_open_2_end'])) {
$wt_2 = $meta_list['nightlife_open_2_end'];
} else
$wt_2 = null;
if (isset($meta_list['nightlife_open_3_start'])) {
$sr_1 = $meta_list['nightlife_open_3_start'];
} else
$sr_1 = null;
if (isset($meta_list['nightlife_open_3_end'])) {
$sr_2 = $meta_list['nightlife_open_3_end'];
} else
$sr_2 = null;
if (isset($meta_list['nightlife_open_4_start'])) {
$czw_1 = $meta_list['nightlife_open_4_start'];
} else
$czw_1 = null;
if (isset($meta_list['nightlife_open_4_end'])) {
$czw_2 = $meta_list['nightlife_open_4_end'];
} else
$czw_2 = null;
if (isset($meta_list['nightlife_open_5_start'])) {
$pt_1 = $meta_list['nightlife_open_5_start'];
} else
$pt_1 = null;
if (isset($meta_list['nightlife_open_5_end'])) {
$pt_2 = $meta_list['nightlife_open_5_end'];
} else
$pt_2 = null;
if (isset($meta_list['nightlife_open_6_start'])) {
$sob_1 = $meta_list['nightlife_open_6_start'];
} else
$sob_1 = null;
if (isset($meta_list['nightlife_open_6_end'])) {
$sob_2 = $meta_list['nightlife_open_6_end'];
} else
$sob_2 = null;
if (isset($meta_list['nightlife_open_7_start'])) {
$nd_1 = $meta_list['nightlife_open_7_start'];
} else
$nd_1 = null;
if (isset($meta_list['nightlife_open_7_end'])) {
$nd_2 = $meta_list['nightlife_open_7_end'];
} else
$nd_2 = null;
//rest
if (isset($meta_list['rest_open_1_start'])) {
$r_pn_1 = $meta_list['rest_open_1_start'];
} else
$r_pn_1 = null;
if (isset($meta_list['rest_open_1_end'])) {
$r_pn_2 = $meta_list['rest_open_1_end'];
} else
$r_pn_2 = null;
if (isset($meta_list['rest_open_2_start'])) {
$r_wt_1 = $meta_list['rest_open_2_start'];
} else
$r_wt_1 = null;
if (isset($meta_list['rest_open_2_end'])) {
$r_wt_2 = $meta_list['rest_open_2_end'];
} else
$r_wt_2 = null;
if (isset($meta_list['rest_open_3_start'])) {
$r_sr_1 = $meta_list['rest_open_3_start'];
} else
$r_sr_1 = null;
if (isset($meta_list['rest_open_3_end'])) {
$r_sr_2 = $meta_list['rest_open_3_end'];
} else
$r_sr_2 = null;
if (isset($meta_list['rest_open_4_start'])) {
$r_czw_1 = $meta_list['rest_open_4_start'];
} else
$r_czw_1 = null;
if (isset($meta_list['rest_open_4_end'])) {
$r_czw_2 = $meta_list['rest_open_4_end'];
} else $r_czw_2 = null;
if (isset($meta_list['rest_open_5_start'])) {
$r_pt_1 = $meta_list['rest_open_5_start'];
} else $r_pt_1 = null;
if (isset($meta_list['rest_open_5_end'])) {
$r_pt_2 = $meta_list['rest_open_5_end'];
} else
$r_pt_2 = null;
if (isset($meta_list['rest_open_6_start'])) {
$r_sob_1 = $meta_list['rest_open_6_start'];
} else
$r_sob_1 = null;
if (isset($meta_list['rest_open_6_end'])) {
$r_sob_2 = $meta_list['rest_open_6_end'];
} else
$r_sob_2 = null;
if (isset($meta_list['rest_open_7_start'])) {
$r_nd_1 = $meta_list['rest_open_7_start'];
} else
$r_nd_1 = null;
if (isset($meta_list['rest_open_7_end'])) {
$r_nd_2 = $meta_list['rest_open_7_end'];
} else
$r_nd_2 = null;
$params = array(
'object' => $object,'meta' => $meta_list,'rooms' => $rooms,
'rooms_pref' => $rooms_pref,'opinia' => $opinia,'opinia_opisowa' => config('opinia_opisowa'),
'ilosc_opini' => $ilosc_opini,
'link_thumb' => $link_thumb,
'link_full' => $link_full,
'gallery_thumb' => $gallery_thumb,
'gallery_full' => $gallery_full,
'title' => $object['post_title'],
'email' => $meta_list['email_object'],
'web' => $meta_list['obj_site'],
'phone' => $meta_list['obj_phone'],
'typ' => $object['post_url'],
'adres' => $object['post_address'],
'post_code' => $object['post_post'],
'fb' => $meta_list['obj_fb'],
'pref' => $this->m_object_details->get_pref($id),
'typ_hot' => $object['post_object_type'],
'kuchnia' => $this->m_object_details->get_kitchen($id),
'rcena' => $rest_price_range,
'acena' => $atr_price,
'typ_obj' => $this->m_object_details->get_smth($id, 'attraction_eventsorganized'),
'pn_pt' => $pn_pt,'pn_pt_e' => $pn_pt_e,'pt' => $pt,'pt_e' => $pt_e,'sun' => $sun,
'sun_e' => $sun_e,'n_pn_pt' => $n_pn_pt,
'n_pn_pt_e' => $n_pn_pt_e,'n_pt' => $n_pt,
'n_pt_e' => $n_pt_e,'n_sun' => $n_sun,'n_sun_e' => $n_sun_e,
'attr_type' => $attr_type,'pn_1' => $pn_1,'pn_2' => $pn_2,
'wt_1' => $wt_1,'wt_2' => $wt_2,'sr_1' => $sr_1,'sr_2' => $sr_2,
'czw_1' => $czw_1,'czw_2' => $czw_2,'pt_1' => $pt_1, 'pt_2' => $pt_2,
'sob_1' => $sob_1,'sob_2' => $sob_2,
'nd_1' => $nd_1,'nd_2' => $nd_2,'r_pn_1' => $r_pn_1,'r_pn_2' => $r_pn_2,'r_wt_1' => $r_wt_1,
'r_wt_2' => $r_wt_2,'r_sr_1' => $r_sr_1,'r_sr_2' => $r_sr_2,
'r_czw_1' => $r_czw_1,'r_czw_2' => $r_czw_2,
'r_pt_1' => $r_pt_1,'r_pt_2' => $r_pt_2,'r_sob_1' => $r_sob_1,
'r_sob_2' => $r_sob_2,'r_nd_1' => $r_nd_1,'r_nd_2' => $r_nd_2
);
$hotel_data = array(
'hotel_adres' => $object['post_address'],
'hotel_email' => $meta_list['email_object'],
'hotel_telefon' => $meta_list['obj_phone'],
'hotel_post_code' => $object['post_post'],
'hotel_gps_lat' => $meta_list['lat'],
'hotel_gps_lng' => $meta_list['lng'],
'hotel_name' => $object['post_title'],
);
//$this->session->set_userdata('hotel_adres',$adres);
$this->session->set_userdata($hotel_data);
$this->params = array_merge($this->params, $params);
$this->load->view('object_details/index', $this->params);
}
}
not working was added this :
$email = $meta_list['email_object'];
$web = $meta_list['obj_site'];
$telefon = $meta_list['obj_phone'];
$adres = $object['post_address'];
$post_code = $object['post_post'];
$typ = $object['post_url'];
$typ_hot = $object['post_object_type'];
$fb = $meta_list['obj_fb'];
$moc = $this->m_object_details->get_all_meta_key();
$kuchnia = $this->m_object_details->get_kitchen($id);
body is limited to 30 k chars ::<
Codeigntier does not have any rule for class/function code length.Its same as PHP.
As I know PHP does not have any limitation for clasname or function length.So CI does not have any limitation.
But Its hard to debug your such long code where you made mistake.