示例#1
0
<?php

$this->breadcrumbs = array(DocumentoExistente::label(2), Yii::t('app', 'Index'));
$this->menu = array(array('label' => Yii::t('app', 'Crear') . ' ' . DocumentoExistente::label(), 'url' => array('create')), array('label' => Yii::t('app', 'Administrar') . ' ' . DocumentoExistente::label(2), 'url' => array('admin')));
?>

<h1><?php 
echo GxHtml::encode(DocumentoExistente::label(2));
?>
</h1>

<?php 
$this->widget('zii.widgets.CListView', array('dataProvider' => $dataProvider, 'itemView' => '_view'));
示例#2
0
echo $form->textField($model, 'documento', array('maxlength' => 255));
?>
		<?php 
echo $form->error($model, 'documento');
?>
		</div><!-- row -->
		<div class="row">
		<?php 
echo $form->labelEx($model, 'tabla');
?>
		<?php 
echo $form->textField($model, 'tabla', array('maxlength' => 70));
?>
		<?php 
echo $form->error($model, 'tabla');
?>
		</div><!-- row -->

		<label><?php 
echo GxHtml::encode($model->getRelationLabel('documentoExistentes'));
?>
</label>
		<?php 
echo $form->checkBoxList($model, 'documentoExistentes', GxHtml::encodeEx(GxHtml::listDataEx(DocumentoExistente::model()->findAllAttributes(null, true)), false, true));
?>

<?php 
echo GxHtml::submitButton(Yii::t('app', 'Save'));
$this->endWidget();
?>
</div><!-- form -->
 public function actionLogitech()
 {
     $files = explode('*', $_POST['archivos']);
     $uploads_dir = "C:/imagenes/";
     $rutapath = "..//descargas//";
     $id = $_POST['id'];
     $iddoc = $_POST['iddoc'];
     $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 DocumentoExistente();
                 switch ($tabla) {
                     case 'matricula':
                         $model->matricula_id = $iddoc;
                         break;
                     case 'docente':
                         $model->docente_id = $iddoc;
                         break;
                     case 'administrativo':
                         $model->administrativo_id = $iddoc;
                         break;
                 }
                 $model->documentoanexo_id = $id;
                 $model->archivo = $semilla . $file;
                 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;
 }