/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Lead(); $result = new User(); $res = User::Model()->findallByattributes(array('superuser' => 2)); $leaduser = new LeadUsers(); $prop = Priority::Model()->findall(); $rem = Reminders::Model()->findall(); if (isset($_POST['Lead'])) { /* $model->reminder_time=$_POST['Lead']['reminder_time'].':'.$_POST['Lead']['sec']; */ $model->status = 1; $model->min_size = $_POST['Lead']['min_size']; $model->max_size = $_POST['Lead']['max_size']; $model->retailer_webiste = $_POST['Lead']['retailer_webiste']; $model->broker_firstname = $_POST['Lead']['broker_firstname']; $model->broker_lastname = $_POST['Lead']['broker_lastname']; $model->broker_territory = $_POST['Lead']['broker_territory']; $model->broker_company = $_POST['Lead']['broker_company']; /* $model->broker_phone_no= $_POST['broker_phone_no']; $model->broker_cell_no= $_POST['broker_cell_no']; $model->broker_email= $_POST['broker_email']; */ $model->linked_username = $_POST['Lead']['linked_username']; $model->enquiry_date = $_POST['enquiry_date']; $model->create_at = date('Y-m-d-h:i:sa'); $model->country = $_POST['country']; /* $model->reminder_date=$_POST['reminder_date']; */ $model->user_id = Yii::app()->user->id; $model->attributes = $_POST['Lead']; /* echo "<pre>"; print_r(array($model->attributes,$_POST)); */ if ($model->save()) { /* if(isset($_POST['reminder_date'])){ $Last_id = $model->id; $status = 1; Yii::app()->db->createCommand("INSERT INTO `tbl_reminders`(`lead_id`,`date`,`time`,`msg`,`status` ) VALUES ('".$Last_id."', '".$_POST['reminder_date']."','".$_POST['Lead']['reminder_time'].":".$_POST['Lead']['sec']."','".$_POST['Lead']['message']."','".$status."')" )->execute(); } */ $this->redirect(array('admin')); } } $this->render('create', array('model' => $model, 'models' => $res, 'props' => $prop)); }