public function actionpideoferta() { $autoIdAll = $_POST['cajita']; $mensajeerror = ""; if (count($autoIdAll) > 0) { foreach ($autoIdAll as $autoId) { $modelo = Desolpe::model()->findByPk($autoId); if (!is_null($modelo)) { $registros = Maestroclipro::model()->findAll("codart=:vcodigo", array(":vcodigo" => $modelo->codart)); foreach ($registros as $fila) { ///datos de los usuarios a enviar $mensajeerror .= yii::app()->correo->correo_simple(Contactos::getListMailEmpresa($fila->codpro, '210'), Yii::app()->user->email, 'SOLICITUD DE COTIZACION', 'Este es un correo automatico, hay nuevas peticiones de oferta, revisar tu buzon'); if ($mensajeerror == "") { echo " Se ha enviado las peticiones de oferta correspondientes"; } $modelito = Ofertas::model()->find("id=:vid", array(":vid" => $modelo->id)); if (is_null($modelito)) { $modelito = new Ofertas(); $modelito->setAttributes(array('hidmaestroclipro' => $fila->id, 'fechaprog' => $modelo->fechaent, 'iduser' => Yii::app()->user->id, 'fechadoc' => date('Y-m-d', time()), 'cant' => $registros->cant, 'iddesolpe' => $modelo->id)); $modelito->save(); } } } } } if ($mensajeerror == "") { echo " Se ha enviado las peticiones de oferta correspondientes"; } }
<?php $this->widget('zii.widgets.grid.CGridView', array('id' => 'materiales-grid', 'dataProvider' => Maestroclipro::model()->search_codigo($codpro), 'itemsCssClass' => 'table table-striped table-bordered table-hover', 'columns' => array('id', 'codart', 'maestroclipro_maestrocompo.descripcion', 'codpro', 'codmon', 'precio', array('class' => 'CButtonColumn', 'template' => '{update}', 'buttons' => array('update' => array('url' => '$this->grid->controller->createUrl("/Clipro/Actualizamateriales", array("id"=>$data->id, "codpro"=>$data->codpro, "asDialog"=>1, "gridId"=>$this->grid->id ) )', 'click' => 'function(){ $("#cru-frame4").attr("src",$(this).attr("href")); $("#cru-dialog4").dialog("open"); return false; }')))))); ?> <?php //--------------------- begin new code -------------------------- // add the (closed) dialog for the iframe $this->beginWidget('zii.widgets.jui.CJuiDialog', array('id' => 'cru-dialog4', 'options' => array('autoOpen' => false, 'modal' => false, 'width' => 500, 'height' => 400))); ?> <iframe id="cru-frame4" width="100%" height="100%" BORDER="0"></iframe> <?php $this->endWidget(); //--------------------- end new code --------------------------
/** * 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 Maestroclipro the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Maestroclipro::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function actionActualizamateriales($id) { $model = Maestroclipro::model()->findByPk($id); // Uncomment the following line if AJAX validation is needed $this->performAjaxValidation($model); if (isset($_POST['Maestroclipro'])) { $model->attributes = $_POST['Maestroclipro']; if ($model->save()) { if (!empty($_GET['asDialog'])) { //Close the dialog, reset the iframe and update the grid echo CHtml::script("window.parent.\$('#cru-dialog4').dialog('close');window.parent.\$('#cru-frame4').attr('src','');window.parent.\$.fn.yiiGridView.update('{$_GET['gridId']}');"); Yii::app()->end(); } } else { } //----- begin new code -------------------- //if (!empty($_GET['asDialog'])) $this->layout = '//layouts/iframe'; //----- end new code -------------------- } if (!empty($_GET['asDialog'])) { $this->layout = '//layouts/iframe'; } $this->render('_form_materiales', array('model' => $model, 'codpro' => $model->codpro)); }