<h1> <?php $docname = DocumentoAnexo::model()->findByPk($id)->documento; echo Yii::t('app', 'Cargar ') . ' ' . GxHtml::encode($docname); ?> </h1> <?php $this->renderPartial('_form', array('model' => $model, 'docname' => $docname, 'modelgrid' => $modelgrid, 'id' => $id, 'iddoc' => $iddoc, 'buttons' => 'create'));
<?php $this->breadcrumbs = array($model->label(2) => array('index'), Yii::t('app', 'Manage')); $this->menu = array(array('label' => Yii::t('app', 'Listar') . ' ' . $model->label(2), 'url' => array('index')), array('label' => Yii::t('app', 'Crear') . ' ' . $model->label(), 'url' => array('create'))); Yii::app()->clientScript->registerScript('search', "\r\n\$('.search-button').click(function(){\r\n\t\$('.search-form').toggle();\r\n\treturn false;\r\n});\r\n\$('.search-form form').submit(function(){\r\n\t\$.fn.yiiGridView.update('documento-existente-grid', {\r\n\t\tdata: \$(this).serialize()\r\n\t});\r\n\treturn false;\r\n});\r\n"); ?> <h1><?php echo Yii::t('app', 'Administrar') . ' ' . GxHtml::encode($model->label(2)); ?> </h1> <p> Si lo desea, puede entrar en un operador de comparación (<, <=, >, >=, <> o =) al principio de cada uno de los valores de la búsqueda para especificar la forma en la comparación se debe hacer. </p> <?php echo GxHtml::link(Yii::t('app', 'Búsqueda Avanzada'), '#', array('class' => 'search-button')); ?> <div class="search-form"> <?php $this->renderPartial('_search', array('model' => $model)); ?> </div><!-- search-form --> <?php $this->widget('zii.widgets.grid.CGridView', array('id' => 'documento-existente-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('iddocumentoexistente', array('name' => 'documentoanexo_id', 'value' => 'GxHtml::valueEx($data->documentoanexo)', 'filter' => GxHtml::listDataEx(DocumentoAnexo::model()->findAllAttributes(null, true))), 'archivo', 'matricula_id', 'docente_id', 'fecha_creacion', array('class' => 'CButtonColumn'))));
<div class="row"> <?php echo $form->label($model, 'iddocumentoexistente'); ?> <?php echo $form->textField($model, 'iddocumentoexistente'); ?> </div> <div class="row"> <?php echo $form->label($model, 'documentoanexo_id'); ?> <?php echo $form->dropDownList($model, 'documentoanexo_id', GxHtml::listDataEx(DocumentoAnexo::model()->findAllAttributes(null, true)), array('prompt' => Yii::t('app', 'All'))); ?> </div> <div class="row"> <?php echo $form->label($model, 'archivo'); ?> <?php echo $form->textArea($model, 'archivo'); ?> </div> <div class="row"> <?php echo $form->label($model, 'matriculaespejo_id');
public function actionLogitech() { $files = explode('*', $_POST['archivos']); $uploads_dir = "C:/imagenes/"; $rutapath = "..//descargas//"; $id = $_POST['id']; $iddoc = $_POST['iddoc']; $dane = $_POST['dane']; $tipdoc = $_POST['tipdoc']; $doc = $_POST['doc']; $retorno = ""; $tabla = DocumentoAnexo::model()->findBypk($id)->tabla; if (!is_dir($uploads_dir)) { mkdir($uploads_dir, 7777); $retorno = "Asegúrese de ingresar a las preferencias de la camara y cambiar la carpeta por defecto de las imágenes a {$uploads_dir}"; } else { foreach ($files as $file) { if (file_exists($uploads_dir . $file) && $file != "") { unset($model); $semilla = md5(date('YmdHisu')) . "_" . Yii::app()->user->getId() . "_"; $model = new DocumentoNuevo(); switch ($tabla) { case 'matricula': $model->matriculaespejo_id = $iddoc; break; case 'docente': $model->docenteespejo_id = $iddoc; break; case 'administrativo': $model->administrativoespejo_id = $iddoc; break; } $model->documentoanexo_id = $id; $model->archivo = $semilla . $file; $model->CODIGO_DANE_SEDE = $dane; $model->TIPO_DOCUMENTO = $tipdoc; $model->NRO_DOCUMENTO = $doc; if ($model->save()) { if (copy($uploads_dir . $file, $rutapath . $semilla . $file)) { unlink($uploads_dir . $file); $retorno = "ok"; } } else { $retorno .= "error al guardar en la base el archivo {$file},"; } } elseif ($file != "") { $retorno .= "la imagen {$file} no existe en el directorio seleccionado,"; } } } echo $retorno; }