public function actionCreadestinatario($id) { $model = new Mensajesd(); // Uncomment the following line if AJAX validation is needed $this->performAjaxValidation($model); if (isset($_POST['Mensajesd'])) { $model->attributes = $_POST['Mensajesd']; if ($model->save()) { if (!empty($_GET['asDialog'])) { //Close the dialog, reset the iframe and update the grid echo CHtml::script("window.parent.\$('#cru-dialog').dialog('close');window.parent.\$('#cru-frame').attr('src','');window.parent.\$.fn.yiiGridView.update('{$_GET['gridId']}');"); Yii::app()->end(); } } else { throw new CHttpException(404, 'No se pudo grabar el destinatario'); } //----- 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_destintario', array('model' => $model, 'id' => $id)); }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate($idobservacion) { $model = new Observacionesdetalle(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Observacionesdetalle'])) { $model->attributes = $_POST['Observacionesdetalle']; $model->hidobservaciones = $idobservacion; $model->usuario = Yii::app()->user->name; $model->fecha = date("d-m-Y H:i:s"); if ($model->save()) { $modeloinventario = Observaciones::model()->findByPk($idobservacion); } if (!$this->enviamail($modeloinventario, $model->comentario)) { echo "fallo"; yii::app()->end(); } $model->refresh(); if (!empty($_GET['asDialog'])) { //Close the dialog, reset the iframe and update the grid echo CHtml::script("window.parent.\$('#cru-dialog1').dialog('close');\n\t\t\t\t\t\t\t\t\t\t\t\t\t window.parent.\$('#cru-frame1').attr('src','');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twindow.parent.\$.fn.yiiGridView.update('{$_GET['gridId']}');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"); Yii::app()->end(); } $this->render('Confirma', array('id' => $model->id)); Yii::app()->end(); //$this->redirect(array('view','id'=>$model->id)); } $this->layout = '//layouts/iframe'; $this->render('create', array('model' => $model, 'idobservacion' => $idobservacion)); }
public function actionLogin() { if (isset($_POST['token'])) { $this->networkLogin(); } $this->layout = null; $this->breadCrumbs = array('Управление сайтом' => array('/users/default/siteManagment')); $form = new LoginForm(); if (isset($_POST['LoginForm'])) { $form->attributes = $_POST['LoginForm']; if ($form->validate()) { $backUrl = $form->getBackUrl(); if (Yii::app()->getRequest()->getIsAjaxRequest()) { echo CHtml::script("document.location='" . $backUrl . "'"); return; } else { $this->redirect($backUrl); } } } if (Yii::app()->getRequest()->getIsAjaxRequest()) { $this->renderPartial('form/login', array('form' => $form, 'backUrl' => $backurl)); } else { $this->render('login', array('user' => $form, 'backUrl' => $backurl)); } }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate($idinventario) { $model = new Observaciones(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Observaciones'])) { $model->attributes = $_POST['Observaciones']; //$model->usuario=Yii::app()->getModule('user')->user()->username; $modelitoactivo = Inventario::model()->findByPk($model->hidinventario); $model->codestado = '10'; if ($model->save()) { // echo "salio"; $this->enviamail($modelitoactivo, $model); } $model->refresh(); if (!empty($_GET['asDialog'])) { //Close the dialog, reset the iframe and update the grid echo CHtml::script("window.parent.\$('#cru-dialog').dialog('close');\n\t\t\t\t\t\t\t\t\t\t\t\t\t window.parent.\$('#cru-frame').attr('src','');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twindow.parent.\$.fn.yiiGridView.update('{$_GET['gridId']}');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"); Yii::app()->end(); } $this->render('Confirma', array('id' => $model->id)); Yii::app()->end(); } $modeloinventario = Inventario::model()->findByPk($idinventario); $fot = new Fotos($modeloinventario->codigosap, Yii::app()->params['rutafotosinventario'], '.JPG'); $misfotos = $fot->devuelveFotos(); if (!empty($_GET['asDialog'])) { $this->layout = '//layouts/iframe'; } $this->render('create', array('model' => $model, 'modeloinventario' => $modeloinventario, 'misfotos' => $misfotos, 'ruta' => Yii::app()->params['rutafotosinventario_'], 'fot' => $fot)); }
public function registerClientScript() { $cs = Yii::app()->clientScript; $id = $this->imageOptions['id']; $url = $this->getController()->createUrl($this->captchaAction, array(CCaptchaAction::REFRESH_GET_VAR => true)); $js = ""; if ($this->showRefreshButton) { // reserve a place in the registered script so that any enclosing button js code appears after the captcha js // $cs->registerScript('Yii.CCaptcha#' . $id, '// dummy'); echo CHtml::script('// dummy'); $label = $this->buttonLabel === null ? Yii::t('yii', 'Get a new code') : $this->buttonLabel; $options = $this->buttonOptions; if (isset($options['id'])) { $buttonID = $options['id']; } else { $buttonID = $options['id'] = $id . '_button'; } if ($this->buttonType === 'button') { $html = CHtml::button($label, $options); } else { $html = CHtml::link($label, $url, $options); } $js = "jQuery('#{$id}').after(" . CJSON::encode($html) . ");"; $selector = "#{$buttonID}"; } if ($this->clickableImage) { $selector = isset($selector) ? "{$selector}, #{$id}" : "#{$id}"; } if (!isset($selector)) { return; } $js .= "\njQuery(document).on('click', '{$selector}', function(){\n\tjQuery.ajax({\n\t\turl: " . CJSON::encode($url) . ",\n\t\tdataType: 'json',\n\t\tcache: false,\n\t\tsuccess: function(data) {\n var url = data['url'].split('?v=');\n var newCode = url[url.length - 1];\n var imgSrc = jQuery('#{$id}').attr('src').split('/');\n var oldCode = imgSrc[imgSrc.length - 1];\n var newUrl = jQuery('#{$id}').attr('src').replace(oldCode, newCode);\n \n\t\t\tjQuery('#{$id}').attr('src', newUrl);\n\t\t\tjQuery('body').data('{$this->captchaAction}.hash', [data['hash1'], data['hash2']]);\n\t\t}\n\t});\n\treturn false;\n});\n"; // $cs->registerScript('Yii.CCaptcha#' . $id, $js); echo CHtml::script($js); }
/** * Generate script code for CKEditor basepath definition. * @return string Generated script code. */ public static function generateBasepath() { $CKEditorExtPath = dirname(dirname(__FILE__)) . '/vendors/CKEditor'; $CKEditorUrl = CJavaScript::encode(Yii::app()->assetManager->getPublishedUrl($CKEditorExtPath) . '/'); $script = "var CKEDITOR_BASEPATH = {$CKEditorUrl};"; return CHtml::script($script); }
public function actionRecibevalor() { $autoIdAll = array(); if (isset($_GET['checkselected'])) { $autoIdAll = $_GET['checkselected']; ///The records selecteds } if (count($autoIdAll) > 0) { echo CHtml::script("window.parent.\$('#cru-dialog3').dialog('close');\t\t\t\t\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twindow.parent.\$('#cru-frame3').attr('src','');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar caja=window.parent.\$('#cru-dialog3').data('hilo');\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar valoresclave= new Array();\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar cadenita='{$autoIdAll[0]}';\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar valoresclave=cadenita.split('_');\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twindow.parent.\$('#'+caja+'').attr('value',valoresclave[0]);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twindow.parent.\$('#'+caja+'_99').html(valoresclave[1]);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"); Yii::app()->end(); } else { $campo = $_GET['campo']; $relaciones = $_GET['relaciones']; //$modeliz=new MaestroGrupos; //$relaciones=$modeliz->relations(); $nombreclase = Yii::app()->explorador->nombreclase($campo, $relaciones); //$tipodato=gettype(Yii::app()->explorador->devuelvemodelo($campo,$relaciones)); $model = Yii::app()->explorador->devuelvemodelo($campo, $relaciones); $model->unsetAttributes(); if (isset($_GET[$nombreclase])) { $model->attributes = $_GET[$nombreclase]; } $this->layout = '//layouts/iframe'; $this->render("ext.explorador.views.vw_" . $nombreclase, array('model' => $model)); //$this->render("ext.explorador.views.vw_pruebitas1",array('tipodato'=>$tipodato,'tablita'=>$nombreclase,'campo'=>$campo,'relaciones'=>$relaciones)); } }
/** * Displays a particular model. * @param integer $id the ID of the model to be displayed */ public function actionView($id) { if (Yii::app()->request->isAjaxRequest) { //outputProcessing = true because including css-files ... $this->renderPartial('view', array('model' => $this->loadModel($id)), false, true); //js-code to open the dialog if (!empty($_GET['asDialog'])) { echo CHtml::script('$("#dialog_id").dialog("open").dialog( { title: "Detail View" } )'); } Yii::app()->end(); } else { $this->render('view', array('model' => $this->loadModel($id))); } }
/** * Inserts the scripts at the beginning of the body section. * @param string the output to be inserted with scripts. */ public function renderOnRequest() { $html = ''; foreach ($this->scriptFiles as $scriptFiles) { foreach ($scriptFiles as $scriptFile) { $html .= CHtml::scriptFile($scriptFile) . "\n"; } } foreach ($this->scripts as $script) { $html .= CHtml::script(implode("\n", $script)) . "\n"; } if ($html !== '') { return $html; } }
/** * override needed to check if its ajax, the redirect will be by javascript */ public function redirect($url, $terminate = true, $statusCode = 302) { if (!Yii::app()->getRequest()->getIsAjaxRequest()) { return parent::redirect($url, $terminate, $statusCode); } else { if (is_array($url)) { $route = isset($url[0]) ? $url[0] : ''; $url = $this->createUrl($route, array_splice($url, 1)); } echo CHtml::script("window.top.location='{$url}'"); if ($terminate) { Yii::app()->end($statusCode); } } }
public function init() { $path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'media'; $url = Yii::app()->getAssetManager()->publish($path); $imgUrl = $url . '/print.png'; echo CHtml::link("<i class='icon-white icon-print'></i> Imprimir", "#", array_merge($this->htmlOptions, array('onclick' => 'return processPrint();', 'class' => 'btn btn-info'))); self::$count++; if (self::$count == 1) { $cs = Yii::app()->getClientScript(); $cs->registerCssFile($url . '/' . $this->cssFile); Yii::app()->clientScript->registerCoreScript('jquery'); echo CHtml::script("\n var firstTime = true;\n function processPrint()\n {\n if (firstTime) {\n \$('{$this->coverElement}').addClass('printWidgetScreenCover');\n \n title = '{$this->title}';\n if (title != '')\n \$('<h3 class=\\'printWidgetPrintedElement\\'>'+title+'</h3>').appendTo('body');\n \n arrayEl = \$('{$this->printedElement}').get();\n for (var i=0; i<arrayEl.length; i++) {\n clonedEl = \$(arrayEl[i]).clone();\n \$(clonedEl).find('a').removeAttr('href');\n clonedEl.addClass('printWidgetPrintedElement');\n clonedEl.appendTo('body');\n }\n \n firstTime = false;\n }\n \$('{$this->coverElement}').addClass('printWidgetScreenCover');\n window.print();\n return false;\n }\n "); echo CHtml::css("\n .printWidgetScreenCover {display: none;}\n .printWidgetPrintedElement {display: block; margin: 0px;}\n ", "print"); echo CHtml::css("\n .printWidgetPrintedElement {display: none;}\n ", "screen"); } }
public function init() { $path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'media'; $url = Yii::app()->getAssetManager()->publish($path); $imgUrl = $url . '/print.gif'; echo CHtml::link("<img src=\"{$imgUrl}\" class=\"img_link\" title=\"" . Yii::t('lms', 'print') . "\">", "#", array_merge($this->htmlOptions, array('onclick' => 'return processPrint();'))); self::$count++; if (self::$count == 1) { $cs = Yii::app()->getClientScript(); $cs->registerCssFile($url . '/' . $this->cssFile); Yii::app()->clientScript->registerCoreScript('jquery'); echo CHtml::script("\n var firstTime = true;\n function processPrint()\n {\n if (firstTime) {\n \$('{$this->coverElement}').addClass('printWidgetScreenCover');\n \n title = '{$this->title}';\n if (title != '')\n \$('<h3 class=\\'printWidgetPrintedElement\\'>'+title+'</h3>').appendTo('body');\n \n arrayEl = \$('{$this->printedElement}').get();\n for (var i=0; i<arrayEl.length; i++) {\n clonedEl = \$(arrayEl[i]).clone();\n clonedEl.addClass('printWidgetPrintedElement');\n clonedEl.appendTo('body');\n }\n \n firstTime = false;\n }\n window.print();\n return false;\n }\n "); echo CHtml::css("\n .printWidgetScreenCover {display: none;}\n .printWidgetPrintedElement {display: block; padding-top:15px;margin-bottom: 0px;margin-top: 0px;margin-left: 20px;margin-right: 20px;}\n ", "print"); echo CHtml::css("\n .printWidgetPrintedElement {display: none;}\n ", "screen"); } }
public function processScripts($applyList = false) { if ($applyList) { $this->scripts[] = ' placemarksYMap = placemarksAll; if(typeof list !== "undefined"){ list.apply(); } '; } // end of ymaps.ready(function () { $this->scripts[] = ' }); }); '; // publish scripts echo CHtml::script(implode("\n", $this->scripts)); }
/** * Inserts the scripts at the beginning of the body section. * @param boolean $includeScriptFiles whether to include external files, or just dynamic scripts * @return string the output to be inserted with scripts. */ public function renderOnRequest($includeScriptFiles = false) { $html = ''; if ($includeScriptFiles) { foreach ($this->scriptFiles as $scriptFiles) { foreach ($scriptFiles as $scriptFile) { $html .= CHtml::scriptFile($scriptFile) . "\n"; } } } foreach ($this->scripts as $script) { // the good stuff! $html .= CHtml::script(implode("\n", $script)) . "\n"; } if ($html !== '') { return $html; } }
public function actionUpdate($id) { $model = $this->loadModel($id); if (isset($_POST['Tenores'])) { $model->attributes = $_POST['Tenores']; if ($model->save()) { if (!empty($_GET['asDialog'])) { //Close the dialog, reset the iframe and update the grid echo CHtml::script("window.parent.\$('#cru-dialogdetalle').dialog('close');\n\t\t\t\t\t\t\t\t\t\t\t\t\t window.parent.\$('#cru-detalle').attr('src','');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t window.parent.\$.fn.yiiGridView.update('{$_GET['gridId']}');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"); Yii::app()->end(); } } $this->redirect(array('view', 'id' => $model->id)); } if (!empty($_GET['asDialog'])) { $this->layout = '//layouts/iframe'; } $this->render('update', array('model' => $model)); }
/** * Updates a particular model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id the ID of the model to be updated */ public function actionUpdate($id) { $model = $this->loadModel($id); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Coordreporte'])) { $model->attributes = $_POST['Coordreporte']; if ($model->save()) { if (!empty($_GET['asDialog'])) { //Close the dialog, reset the iframe and update the grid echo CHtml::script("window.parent.\$('#cru-dialogdetalle').dialog('close');\n\t\t\t\t\t\t\t\t\t\t\t\t\t window.parent.\$('#cru-detalle').attr('src','');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t window.parent.\$.fn.yiiGridView.update('{$_GET['gridId']}');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"); Yii::app()->end(); } } } if (!empty($_GET['asDialog'])) { $this->layout = '//layouts/iframe'; } $this->render('_form', array('model' => $model)); }
public function actionCreadetallecaja($id) { //el modelo padre es le registro del detalle caja chica que genero la deuda $modelopadre = Dcajachica::model()->findbypk($id); if (is_null($modelopadre)) { throw new CHttpException(500, 'No existe estaregistrop con este id'); } else { //verificar que no sea otro usuario $codigotra = Yii::app()->user->um->getFieldValue(Yii::app()->user->id, 'codtra'); if (is_null($codigotra)) { throw new CHttpException(500, ' Eres usuario pero no estas registrado como trabajador '); //yii::app()->user->setFlash('notice'," Eres usuario pero no estas registrado como trabajador "); //yii::app()->end(); } else { if (!$modelopadre->codtra == $codigotra) { throw new CHttpException(500, ' Estas intentando rendir una cuenta que no es la tuya '); //yii::app()->user->setFlash('error'," Estas intentando rendir una cuenta que no es la tuya "); //yii::app()->end(); } else { $model = new Dcajachica(); $model->setScenario('ins_rendiciontrabajador'); $model->codtra = $codigotra; $model->hidcaja = $modelopadre->hidcaja; $model->hidcargo = $modelopadre->id; if (isset($_POST['Dcajachica'])) { $model->attributes = $_POST['Dcajachica']; if ($model->save()) { if (!empty($_GET['asDialog'])) { //Close the dialog, reset the iframe and update the grid echo CHtml::script("window.parent.\$('#cru-dialogdetalle').dialog('close');\n\t\t\t\t\t\t\t\t\t\t\t\t\t window.parent.\$('#cru-detalle').attr('src','');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twindow.parent.\$.fn.yiiGridView.update('detalle-grid');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"); Yii::app()->end(); } } } // if (!empty($_GET['asDialog'])) $this->layout = '//layouts/iframe'; $this->render('_form_detalle', array('model' => $model, 'idcabeza' => $model->hidcaja)); } } } }
protected function processLogs($logs) { if (Yii::app()->getRequest()->getIsAjaxRequest()) { return false; } $DBLogs = $this->getCallstack($logs); $mem = round(Yii::getLogger()->getMemoryUsage() / 1024 / 1024, 3); $time = round(Yii::getLogger()->getExecutionTime(), 3); $queryTime = 0; foreach ($DBLogs as $l) { $queryTime += $l[1]; } $DB = Yii::t('QtzPanel.app', '{driver}: {n} query in {s} s.|{driver}: {n} queries in {s} s.', array(count($DBLogs), '{driver}' => Yii::app()->db->getDriverName(), '{s}' => vsprintf('%0.4F', $queryTime))); $flogs = $logs; foreach ($flogs as &$l) { $t = explode('.', $l[3]); $l[3] = Yii::app()->getDateFormatter()->format('h:m:s', $l[3]) . ' ' . $t[1]; } $js = 'QtzPanelHelper.setLogs(' . CJavaScript::jsonEncode($flogs) . ');' . 'QtzPanelHelper.setDBStat(' . CJavaScript::jsonEncode($DB) . ');' . 'QtzPanelHelper.setDBLogs(' . CJavaScript::jsonEncode($DBLogs) . ');' . 'QtzPanelHelper.setMemory(' . CJavaScript::jsonEncode($mem) . ');' . 'QtzPanelHelper.setTime(' . CJavaScript::jsonEncode($time) . ');'; echo CHtml::script($js); }
/** * function to render form login on login tabs */ public function actionform_login() { $model = new LoginForm(); $cs = Yii::app()->clientScript; if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') { echo CActiveForm::validate($model); Yii::app()->end(); } $cs->scriptMap['jquery.js'] = false; $cs->scriptMap['jquery.yiiactiveform.js'] = false; // collect user input data if (isset($_POST['LoginForm'])) { $model->attributes = $_POST['LoginForm']; // validate user input and redirect to the previous page if valid if ($model->validate() && $model->login()) { $redirectUrl = Yii::app()->createUrl('home'); echo CHtml::script("location.href='{$redirectUrl}';"); Yii::app()->end(); } } $this->renderPartial('_formlogin', array('model' => $model), false, true); Yii::app()->end(); }
public function actionModificadetalle($id) { $model = Cargamasivadet::Model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'No se encontro ningun documento para estos datos'); } // $this->performAjaxValidation($model); if (isset($_POST['Cargamasivadet'])) { $model->attributes = $_POST['Cargamasivadet']; if ($model->save()) { if (!empty($_GET['asDialog'])) { //Yii::app()->user->setFlash('success', "..Se agrego el item!"); //Close the dialog, reset the iframe and update the grid echo CHtml::script("window.parent.\$('#cru-dialogdetalle').dialog('close');\n\t\t\t\t\t\t\t\t\t\t\t\t\t window.parent.\$('#cru-detalle').attr('src','');\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twindow.parent.\$.fn.yiiGridView.update('detalle-grid');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"); Yii::app()->end(); } } } if (!empty($_GET['asDialog'])) { $this->layout = '//layouts/iframe'; } $this->render('_cargamasiva', array('model' => $model, 'idcabeza' => $model->id)); }
public function actionCreadetalle($idcabeza) { $model = new Maestrosolicitudes(); // Uncomment the following line if AJAX validation is needed $this->performAjaxValidation($model); if (isset($_POST['Maestrosolicitudes'])) { $model->attributes = $_POST['Maestrosolicitudes']; $model->codigodoc = '042'; ///detalle guia $model->hid = $idcabeza; if ($model->save()) { if (!empty($_GET['asDialog'])) { //Close the dialog, reset the iframe and update the grid echo CHtml::script("window.parent.\$('#cru-dialogdetalle').dialog('close');\n\t\t\t\t\t\t\t\t\t\t\t\t\t window.parent.\$('#cru-detalle').attr('src','');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twindow.parent.\$.fn.yiiGridView.update('detalle-grid');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"); Yii::app()->end(); } } //$this->redirect(array('view','id'=>$model->n_guia)); } if (!empty($_GET['asDialog'])) { $this->layout = '//layouts/iframe'; } $this->render('_form_detalle', array('model' => $model, 'idcabeza' => $idcabeza)); }
<?php $language = TranslateModule::translator(); $languageKey = $language->languageKey; $google = !empty(TranslateModule::translator()->googleApiKey) ? true : false; Yii::app()->controller->pageTitle = TranslateModule::t('Translate to {lang}', array('{lang}' => $language->acceptedLanguages[$language->getLanguage()])); ?> </h2 <?php if ($google) { echo CHtml::link(TranslateModule::t('Translate all with google translate'), "#", array('id' => $languageKey . "-google-translateall")); echo CHtml::script("\$('#{$languageKey}-google-translateall').click(function(){\r\n var messages=[];\$('.{$languageKey}-google-message').each(function(count){\r\n messages[count]=\$(this).html();\r\n });" . CHtml::ajax(array('url' => $this->createUrl('translate/googletranslate'), 'type' => 'post', 'dataType' => "json", 'data' => array('language' => Yii::app()->getLanguage(), 'sourceLanguage' => Yii::app()->sourceLanguage, 'message' => 'js:messages'), 'success' => "js:function(response){\r\n \$('.{$languageKey}-google-translation').each(function(count){\r\n \$(this).val(response[count]);\r\n });\r\n \$('.{$languageKey}-google-button,#{$languageKey}-google-translateall').hide();\r\n }", 'error' => 'js:function(xhr){alert(xhr.statusText);}')) . "\r\n return false;\r\n });\r\n "); if (Yii::app()->getRequest()->isAjaxRequest) { echo CHtml::script("\r\n \$('#" . TranslateModule::translator()->languageKey . '-pager' . " a').click(function(){\r\n \$dialog=\$('#" . TranslateModule::translator()->languageKey . '-dialog' . "').load(\$(this).attr('href'));\r\n return false;\r\n });\r\n "); } } ?> <div class="form"> <?php echo CHtml::beginForm(); ?> <table> <thead> <th><?php echo MessageSource::model()->getAttributeLabel('category'); ?> </th> <th><?php echo MessageSource::model()->getAttributeLabel('message'); ?> </th>
public function renderBodyEnd(&$output) { if (!isset($this->scriptFiles[self::POS_END]) && !isset($this->scripts[self::POS_END]) && !isset($this->scripts[self::POS_READY]) && !isset($this->scripts[self::POS_LOAD])) { return; } $fullPage = 0; $output = preg_replace('/(<\\/body\\s*>)/is', '<###end###>$1', $output, 1, $fullPage); $html = ''; if (isset($this->scriptFiles[self::POS_END])) { foreach ($this->scriptFiles[self::POS_END] as $scriptFile) { $html .= CHtml::scriptFile($scriptFile) . "\n"; } } $scripts = isset($this->scripts[self::POS_END]) ? $this->scripts[self::POS_END] : array(); if (isset($this->scripts[self::POS_READY])) { if ($fullPage) { $scripts[] = "jQuery(function(\$) {\n" . implode("\n", $this->scripts[self::POS_READY]) . "\n});"; } else { $scripts[] = implode("\n", $this->scripts[self::POS_READY]); } } if (isset($this->scripts[self::POS_LOAD])) { if ($fullPage) { $scripts[] = "jQuery(window).on('load',function() {\n" . implode("\n", $this->scripts[self::POS_LOAD]) . "\n});"; } else { $scripts[] = implode("\n", $this->scripts[self::POS_LOAD]); } } if (!empty($scripts)) { $html .= CHtml::script(implode("\n", $scripts)) . "\n"; } if ($fullPage) { $output = str_replace('<###end###>', $html, $output); } else { $output = $output . $html; } }
/** * Composes script HTML block from the given script values, * attempting to group scripts at single 'script' tag if possible. * @param array $scripts script values to process. * @return string HTML output */ protected function renderScriptBatch(array $scripts) { $html = ''; $scriptBatches = array(); foreach ($scripts as $scriptValue) { if (is_array($scriptValue)) { $scriptContent = $scriptValue['content']; unset($scriptValue['content']); $scriptHtmlOptions = $scriptValue; } else { $scriptContent = $scriptValue; $scriptHtmlOptions = array(); } $key = serialize(ksort($scriptHtmlOptions)); $scriptBatches[$key]['htmlOptions'] = $scriptHtmlOptions; $scriptBatches[$key]['scripts'][] = $scriptContent; } foreach ($scriptBatches as $scriptBatch) { if (!empty($scriptBatch['scripts'])) { $html .= CHtml::script(implode("\n", $scriptBatch['scripts']), $scriptBatch['htmlOptions']) . "\n"; } } return $html; }
public function actionCreaservicio($idcabeza, $cest) { //VERIFICADO PRIMERO SI ES POSIBLE AGREGAR MAS ITEMS $modelocabeza = Solpe::model()->findbypk($idcabeza); if (is_null($modelocabeza)) { throw new CHttpException(500, 'No existe esta solicitud con este ID'); } if ($modelocabeza->estado == ESTADO_CREADO or $modelocabeza->estado == ESTADO_PREVIO) { $model = new Desolpe(); $model->setScenario('servicios'); $model->valorespordefecto(); // Uncomment the following line if AJAX validation is needed $this->performAjaxValidation($model); if (isset($_POST['Desolpe'])) { $model->attributes = $_POST['Desolpe']; $model->codocu = '350'; ///detalle guia $model->tipsolpe = 'S'; //SERVICIO $model->codart = CODIGO_MATERIAL_SERVICIO; /*var_dump($model->codart); yii::app()->end();*/ if ($model->save()) { if (!empty($_GET['asDialog'])) { //Close the dialog, reset the iframe and update the grid echo CHtml::script("window.parent.\$('#cru-dialogdetalle').dialog('close');\n\t\t\t\t\t\t\t\t\t\t\t\t\t window.parent.\$('#cru-detalle').attr('src','');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twindow.parent.\$.fn.yiiGridView.update('detalle-grid');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"); Yii::app()->end(); } } } // if (!empty($_GET['asDialog'])) $this->layout = '//layouts/iframe'; $this->render('_form_servicio', array('model' => $model, 'idcabeza' => $idcabeza)); } else { //si ya cambio el estado impisble agregar mas items if (!empty($_GET['asDialog'])) { $this->layout = '//layouts/iframe'; } $this->render('vw_imposible', array()); } }
/** * Check if a dialog has to be closed and render the js-output * Usage: see header comment * * @static * @param null $customJsScript * @return bool */ public static function checkDialogJsScript($customJsScript = null) { if (!self::isDialogRequest()) { return false; } $script = ''; $closeOnAction = !empty($_GET[self::URLPARAM_CLOSEONACTION]) ? $_GET[self::URLPARAM_CLOSEONACTION] : false; if ($closeOnAction) { $dialogId = !empty($_GET[self::URLPARAM_DIALOGID]) ? $_GET[self::URLPARAM_DIALOGID] : null; $gridId = !empty($_GET[self::URLPARAM_GRIDID]) ? $_GET[self::URLPARAM_GRIDID] : null; $iframeId = !empty($_GET[self::URLPARAM_IFRAMEID]) ? $_GET[self::URLPARAM_IFRAMEID] : null; if (!empty($dialogId)) { $script .= "window.parent.\$('#{$dialogId}').dialog('close');"; } if (!empty($iframeId)) { $script .= "window.parent.\$('#{$iframeId}').attr('src','');"; } } if (!empty($gridId)) { $script .= "window.parent.\$.fn.yiiGridView.update('{$gridId}');"; } if (!empty($customJsScript)) { $script .= $customJsScript; } if (!empty($script)) { echo CHtml::script($script); } if ($closeOnAction && !empty($dialogId)) { Yii::app()->end(); } die(htmlentities($script)); return !empty($script); }
?> </div> <?php if ($i != $show) { echo CHtml::script(' function refresh() { ' . CHtml::ajax(array('type' => 'POST', 'dataType' => 'json', 'success' => 'js:set_status', 'data' => array('ajax' => 'get_status', Yii::app()->request->csrfTokenName => Yii::app()->request->csrfToken))) . ' } function set_status(data) { var expect = "' . $show . '"; if (expect == data) { $("#pending").hide(); $("#regular").show(); return; } scheduleRefresh(); } function scheduleRefresh(delay) { setTimeout(function() { refresh(); }, ' . $this->ajaxUpdateInterval . '); } $(document).ready(function() { scheduleRefresh(); }); '); } ?> <br/> <br/>
public function actionagregarrangos($id, $idu) { $modelopadre = $this->loadModel($id); $usuario = Yii::app()->user->um->loadUserById($idu, true); /*var_dump($usuario); yii::app()->end();*/ if (is_null($usuario)) { throw new CHttpException(500, 'El userId ' . $idu . ' no existe.'); } $model = new Authobjetosrango('centros'); if (isset($_POST['Authobjetosrango'])) { $model->attributes = $_POST['Authobjetosrango']; $model->iduser = $idu; $model->hidobjeto = $modelopadre->id; $model->signo = 1; $model->save(); /*print_r($model->geterrors()); yii::app()->end();*/ if (!empty($_GET['asDialog'])) { //Close the dialog, reset the iframe and update the grid echo CHtml::script("window.parent.\$('#cru-dialog3').dialog('close');\n\t\t\t\t\t\t\t\t\t\t\t\t\t window.parent.\$('#cru-detalle3').attr('src','');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twindow.parent.\$.fn.yiiGridView.update('detalle-grid2');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"); Yii::app()->end(); } } // if (!empty($_GET['asDialog'])) $this->layout = '//layouts/iframe'; $this->render('vw_centros_rango', array('model' => $model)); }
<?php /** * * Copyright © 2010-2012 by xhost.ch GmbH * * All rights reserved. * **/ $this->pageTitle = Yii::app()->name . ' - ' . Yii::t('mc', 'Minecraft FTP Client'); $this->breadcrumbs = array(Yii::t('mc', 'FTP Client') => array('index', 'id' => $server->id), $server->name => array('browse', 'id' => $server->id), Yii::t('mc', 'FTP')); Yii::app()->getClientScript()->registerCoreScript('jquery'); ?> <?php echo $css; echo $js; ?> <?php echo CHtml::script('$(document).ready(function() { ' . $onload . ' });'); ?> <?php echo $body;
/** * Manages all models. */ public function actionAgregamaterial($idcabeza) { $idcabeza = (int) $idcabeza; $modelocabeza = Listamateriales::model()->findbypk($idcabeza); if (is_null($modelocabeza)) { throw new CHttpException(500, 'No existe esta lista con este ID'); } $model = new Dlistamaeriales(); $model->hidlista = $modelocabeza->id; if (isset($_POST['Dlistamaeriales'])) { $model->attributes = $_POST['Dlistamaeriales']; if ($model->save()) { if (!empty($_GET['asDialog'])) { //Close the dialog, reset the iframe and update the grid echo CHtml::script("window.parent.\$('#cru-dialog').dialog('close');\n\t\t\t\t\t\t\t\t\t\t\t\t\t window.parent.\$('#cru-detalle').attr('src','');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twindow.parent.\$.fn.yiiGridView.update('detalle-grid');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"); Yii::app()->end(); } } } // if (!empty($_GET['asDialog'])) $this->layout = '//layouts/iframe'; $this->render('_formdetalle', array('model' => $model, 'idcabeza' => $idcabeza)); }