public function actionIndex() { $model = new CleaningTime(); $list = CleaningTime::model()->findAll(); $cleanDetails = Yii::app()->session['CleaningDetail']; //echo "<pre>";print_r($clean);die; //$zip=ServiceUser::model()->findAll(); $zip = UkPostcodes::model()->findAll(); //echo "<pre>";print_r($zip);die; foreach ($zip as $z) { } $post[] = $z->postcode; $uniquePost = array_unique($post); //code to get the welcome content $welcome = HomeWelcome::model()->find(array('condition' => 'status=1')); $why = WhyUsHome::model()->find(array('condition' => 'status=1')); $Stypes = ServiceTypes::model()->findAll(array('limit' => 3)); $homeImage = HomeImages::model()->findAll(array('condition' => 'status=1')); //echo "<pre>";print_r($homeImage);die; //echo "<pre>";print_r($Stypes);die; $ht = HtuseHome::model()->findAll(array('condition' => 'status=:c', 'limit' => 4, 'params' => array(':c' => 1))); //echo "<pre>";print_r($ht);die; $links = CmsPages::model()->findAll(); Yii::app()->params['MyArray'] = $links; $this->render('index', array('list' => $list, 'model' => $model, 'Post' => $uniquePost, 'wel' => $welcome, 'why' => $why, 'Stypes' => $Stypes, 'homeImage' => $homeImage, 'ht' => $ht, 'cleanDetails' => $cleanDetails)); }
public function actionIndex() { $model = new CleaningTime(); $list = CleaningTime::model()->findAll(); //echo "<pre>";print_r($list);die; $this->render('index', array('list' => $list, 'model' => $model)); }
public function actionEdit() { $model = new CleaningTime(); $service = new ServiceTypes(); $list = CleaningTime::model()->findAll(); $zip = UkPostcodes::model()->findAll(); //echo "<pre>";print_r($zip);die; foreach ($zip as $z) { $post[] = $z->postcode; } $uniquePost = array_unique($post); $record = CompanyRequest::model()->find(array('condition' => 'booking_id=:booking_id AND job_status=:job_status', 'params' => array(':booking_id' => $_REQUEST['id'], ':job_status' => 1))); //echo "<pre>";print_r($rec->booking);die; $ser = ServiceTypes::model()->findAll(); foreach ($ser as $se) { $ids[] = $se['id']; $serNam[] = $se['service_name']; $serName = array_combine($ids, $serNam); } //echo "<pre>";print_r($serName);die; if (isset($_POST['CleaningTime'])) { //echo "<pre>";print_r($_REQUEST);die; $id = $_REQUEST['book']; $re = CompanyRequest::model()->find(array('condition' => 'booking_id=:booking_id ', 'params' => array(':booking_id' => $_REQUEST['book']))); $re->postcode = $_REQUEST['CleaningTime']['PostCode']; $re->cleaningtime = $_REQUEST['CleaningTime']['time']; $re->cleaningdate = date('y-m-d', strtotime($_REQUEST['CleaningTime']['CleaningDate'])); $re->save(false); $booking = Booking::model()->findByPk(array('id' => $id)); $service_type_id = $_REQUEST['ServiceTypes']['service_name']; $booking->service_type_id = $service_type_id; /*if(!empty($_REQUEST['Booking'])) { */ if ($service_type_id == 3) { foreach ($_REQUEST['Booking'] as $key => $value) { //$r.=$value."-".$key.","; $newAr[] = $value . "-" . $key; } $data = implode(',', $newAr); //echo "<pre>";print_r($data);die; $booking->cleaningDetail = $data; } else { foreach (array_slice($_REQUEST['Booking'], 0, 2) as $key => $value) { //$r.=$value."-".$key.","; $newAr[] = $value . "-" . $key; } $data = implode(',', $newAr); //echo "<pre>";print_r($data);die; $booking->cleaningDetail = $data; } //} //echo "<pre>";print_r($r);die; if (!empty($_REQUEST['Additional'])) { //$booking->cleaningDetail=$r; foreach ($_REQUEST['Additional'] as $key => $value) { //echo "<pre>";print_r($value); $res[] = $value . "-" . $key; } $data1 = implode(',', $res); $booking->additional = $data1; } /*email to customer starts here*/ $subject = 'Welcome to Wow Cleans'; $body = $this->renderPartial('updatedquoteEmail', array('model' => $booking), true); Yii::app()->mailer->send($booking->service['email'], $subject, $body); /*email to customer ends here */ $booking->save(false); $this->redirect(array('customerdashboard')); } $links = CmsPages::model()->findAll(); Yii::app()->params['MyArray'] = $links; $this->render('edit', array('list' => $list, 'model' => $model, 'Post' => $uniquePost, 'rec' => $record, 'serName' => $serName, 'service' => $service)); }