public function actionNew() { //cek eror tidaknya // foreach ($_FILES['fileupload']['error'] as $error ){ // // if ($error // if ($error==0) // $no_error = true; // else // $no_error = false; // } // print_r($_FILES['fileupload']); // exit; $transaction = Yii::app()->db->beginTransaction(); try { $model = new Project(); $model->id_member = $_REQUEST['member']; $model->project_name = $_REQUEST['name']; $model->start_date = $_REQUEST['start']; $model->due_date = $_REQUEST['due']; $model->username = 1; $model->task = 1; $model->progres = 0; $model->priority = 1; $model->worker = 0; $model->status = 1; if ($model->save()) { $calendar = new Calendar(); $calendar->project_id = $model->id; $calendar->start_date = $_REQUEST['start']; $calendar->due_date = $_REQUEST['due']; $calendar->description = $_REQUEST['descriptionca'] . " of "; $calendar->type = "due"; if ($calendar->save()) { // echo "sukses"; if ($no_error) { $time = time(); $hm = new ProjectCommentHead(); $hm->datetime = date('Y-m-d H:i:s'); $hm->user_id = 1; $hm->project_id = $model->id; $hm->type = 1; if ($hm->save()) { $transaction->commit(); // foreach($_FILES['fileupload']['tmp_name'] as $key => $tmp_name ){ // $comment = new ProjectComment; // $file_name = $_FILES['fileupload']['name'][$key]; // $file_size =$_FILES['fileupload']['size'][$key]; // $file_tmp =$_FILES['fileupload']['tmp_name'][$key]; // $file_type=$_FILES['fileupload']['type'][$key]; // // echo Yii::app()->request->baseUrl."/img/comment/".".$file_name"; // $comment->name_file = $key.$time.$file_name; // $comment->head_project_id = $hm->id; // $comment->comment_id = 0; // if ($comment->save()){ // if (move_uploaded_file($file_tmp,Yii::app()->basePath."/../img/comment/$key$time$file_name")){ // // echo "sukses"; // } // // else{ // // // echo "sukses"; // // } // } // // echo $file_name. " "; // } } } //kirim email start Yii::import('ext.yii-mail.YiiMailMessage'); $message = new YiiMailMessage(); $message->view = "project_notif"; $params = array('email' => $email, 'name' => $name, 'code' => $code); $message->setBody($params, 'text/html'); $message->subject = "New Project on vvfy"; $message->addTo("*****@*****.**"); $message->addTo("*****@*****.**"); $message->addTo("*****@*****.**"); $message->addTo("*****@*****.**"); $message->from = Yii::app()->params['adminEmail']; // emails to keep in cc // $emails = array("*****@*****.**","*****@*****.**"); // // foreach($emails as $value){ // $message->addCC(trim($value)); // } // $message->from = "Support"; // if (Yii::app()->mail->send($message)) echo "sukses"; // else // echo "gagal"; //kirim emai end } // echo "sukses"; } else { echo json_encode($model->getErrors()); } } catch (Exception $e) { $transaction->rollBack(); // other actions to perform on fail (redirect, alert, etc.) } }
<?php $model = ProjectComment::model()->findByPk($id); // $idh = ProjectComment::model()->findByPk($id)->head_project_id; $head = ProjectCommentHead::model()->findByPk($model->head_project_id); $project = Project::model()->findByPk($head->project_id); $project_name = Project::model()->findByPk(ProjectCommentHead::model()->findByPk($model->head_project_id)->project_id)->project_name; echo $idh; ?> <img class="img-close" src="<?php echo Yii::app()->request->baseUrl; ?> /img/close.png"> <center> <h1> DETAIL PROGRES IMAGE </h1> </center> <table> <tr> <td style="width:30%">Name </td> <td>:</td> <td style="width:70%"> <input maxlength="30" img_id="<?php echo $model->id; ?> " value="<?php echo $model->alias_name; ?> " type="text" id="input-edit-image"> <?php if ($model->alias_name == '') {