예제 #1
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return DettOrdini the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = DettOrdini::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
예제 #2
0
 public function actionAjaxDettagliOrdine($key)
 {
     $dettagli_arr = array();
     $all = array();
     $ordine = DettOrdini::model()->findAllByAttributes(array('id_ordine' => $key));
     if (count($ordine) > 1) {
         foreach ($ordine as $dettagli) {
             $dettagli_arr[] = $dettagli->quantita;
             $dettagli_arr[] = $dettagli->descrizione;
             $dettagli_arr[] = $dettagli->importo_dettaglio;
             $dettagli_arr[] = $dettagli->rl_iva->percentuale;
             $dettagli_arr[] = '<a href=\'javascript:;\' id=' . $dettagli->id_dettaglio_ordini . ' data-toggle=\'modal\' data-target=\'#modifyDettaglio\' onClick=\'ModifyDettaglio(this.id, 0);\'><i class=\'fa fa-pencil text-blue\'></i></a>' . '&nbsp;&nbsp;&nbsp;' . '<a href=\'javascript:;\' onClick=\'deleteDettOrdini(' . $dettagli->id_dettaglio_ordini . ')\'><i class=\'fa fa-trash text-blue\'></i></a>';
             $all[] = $dettagli_arr;
         }
     }
     $iTotalRecords = count($dettagli_arr);
     $iTotalDisplayRecords = 15;
     $output = array("sEcho" => isset($_GET['sEcho']) ? intval($_GET['sEcho']) : 0, "iTotalRecords" => $iTotalRecords, "iTotalDisplayRecords" => $iTotalDisplayRecords, "data" => $all);
     echo json_encode($output);
     Yii::app()->end();
 }