예제 #1
0
 public static function getListTypes()
 {
     $models = FileType::model()->findAll();
     $list = array();
     foreach ($models as $key => $model) {
         $list[$model->id] = $model->name;
     }
     return $list;
 }
예제 #2
0
?>

<?php 
$this->widget('application.extensions.print.printWidget', array('cssFile' => 'print.css', 'printedElement' => '#view', 'htmlOptions' => array('style' => 'padding:20px')));
?>
<div id="view">

    <?php 
$labelRow = Label::model()->findByPk(6);
$attributes = str_replace(' ', '_', strtoupper($labelRow['fields']));
$itemId = $_GET['itemId'];
$connection = Yii::app()->db;
$sql = "\n\t\tselect {$attributes}\n\t\tfrom fopen \n\t\twhere ID ={$itemId}";
$command = $connection->createCommand($sql);
$dataReader = $command->queryAll();
$filetypeRow = FileType::model()->findByAttributes(array('name' => $_GET['fileType']));
$w = (int) $filetypeRow['label_width'];
$h = (int) $filetypeRow['label_height'];
?>
    
	<table class="table table-bordered" style='width:<?php 
echo $w . "px";
?>
;height:<?php 
echo $h . "px";
?>
'>
		<tr>
		<?php 
foreach ($dataReader[0] as $key => $value) {
    echo "<th>{$key}</th>";
예제 #3
0
                <?
                foreach ($files->getData() as $file) {
                    ?>
                    <tr>
                        <?
                        echo $form->hiddenField($file, '[' . $i . ']extension');
                        echo $form->hiddenField($file, '[' . $i . ']id');
                        echo $form->hiddenField($file, '[' . $i . ']dataset_id');
                        echo $form->hiddenField($file, '[' . $i . ']location');
                        echo $form->hiddenField($file, '[' . $i . ']extension');
                        ?>

                        <td class="left"><?php echo $file->name ?></td>
                        <td class="left"><?= CHtml::activeDropDownList($file, '[' . $i . ']code', $samples_data, array('class' => 'span2')); ?></td>

                        <td class="left"><?= CHtml::activeDropDownList($file, '[' . $i . ']type_id', CHtml::listData(FileType::model()->findAll(), 'id', 'name'), array('class' => 'span2')); ?></td>

                        <td> <?= CHtml::activeDropDownList($file, '[' . $i . ']format_id', CHtml::listData(FileFormat::model()->findAll(), 'id', 'name'), array('class' => 'autowidth')); ?></td>
                        <td><span style="display:none"><?= File::staticGetSizeType($file->size) . ' ' . strlen($file->size) . ' ' . $file->size ?></span><?= MyHtml::encode(File::staticBytesToSize($file->size)) ?></td>

                        <td><?php echo $form->textArea($file, '[' . $i . ']description', array('rows' => 3, 'cols' => 30, 'style' => 'resize:none')); ?></td>

                        <td> <?php echo CHtml::submitButton("Update", array('class' => 'update btn', 'name' => $i)); ?> </td>
                    </tr>

                    <?
                    $i++;
                }
                ?>

            </table>
예제 #4
0
 public function updateFile($f, $data)
 {
     $f->name = $data[0];
     $f->code = $data[1];
     $type = $f->type;
     $format = $f->format;
     if ($data[2] != $type->name) {
         $nt = FileType::model()->find(array('condition' => 'lower(name) = :name', 'params' => array(':name' => strtolower($data[2]))));
         if ($nt) {
             $f->type_id = $nt->id;
         } else {
             $nt = FileType::model()->findByAttributes(array('name' => 'Other'));
             if (!$nt) {
                 $nt = new FileType();
                 $nt->name = 'Other';
                 $nt->save();
             }
             $f->type_id = $nt->id;
         }
     }
     if ($data[3] != $format->name) {
         $nf = FileFormat::model()->find(array('condition' => 'lower(name) =:name', 'params' => array(':name' => strtolower($data[3]))));
         if ($nf) {
             $f->format_id = $nf->id;
         } else {
             $nf = FileFormat::model()->findByAttributes(array('name' => 'UNKNOWN'));
             if (!$nf) {
                 $nf->name = 'UNKNOWN';
                 $nf->save();
             }
             $f->format_id = $nf->id;
         }
     }
     $f->description = $data[4];
     if (!$f->save()) {
         Yii::log(print_r($f->getErrors(), true), 'debug');
     }
     return;
 }
예제 #5
0
/* @var $this LabelController */
/* @var $data Label */
?>

<?php 
$this->widget('application.extensions.print.printWidget', array('cssFile' => 'print.css', 'printedElement' => '#view', 'htmlOptions' => array('style' => 'padding:20px')));
?>

<div id="view">

    <?php 
$paper = PaperType::model()->findByAttributes(array('id' => $labelParams['paper']));
$paperWidth = $paper['width'];
if (trim($labelParams['fileType']) != '') {
    $fileType = $labelParams['fileType'];
    $filetypeRow = FileType::model()->findByAttributes(array('id' => $fileType));
} else {
    $filetypeRow['label_width'] = 400;
    $filetypeRow['label_height'] = 100;
}
$label_width = (int) $filetypeRow['label_width'] . 'px';
$label_height = (int) $filetypeRow['label_height'] . 'px';
$paper = $labelParams['paper'];
$numColumns = floor($paperWidth / $filetypeRow['label_width']);
$connection = Yii::app()->db;
if (trim($labelParams['depts']) == '') {
    $sql = "select CODE,TITLE from fopen";
} else {
    $deptRow = Dept::model()->find('id=:id', array(':id' => $labelParams['depts']));
    $deptName = $deptRow['name'];
    /* Which all Files??*/
예제 #6
0
                    <div class="span3"><?php 
echo $form->dropDownList($model, 'paper', CHtml::listData(PaperType::model()->findAll(), 'id', 'name'));
?>
</div>    
                </div>
            </div>
        </tr>
        <tr>
            <div class="row">
                <div class="col-md-3 col-sm-6">
                    <div class="span2"><?php 
echo $form->labelEx($model, 'fileType', array('class' => 'inline-labels'));
?>
</div>
                    <div class="span3"><?php 
echo $form->dropDownList($model, 'fileType', CHtml::listData(FileType::model()->findAll(), 'id', 'name'), array('prompt' => '---', 'ajax' => array('type' => 'POST', 'id' => 'drop_selection', 'url' => CController::createUrl('dynamicrows2'), 'update' => '#details', 'data' => array('selection' => 'js:this.value'))));
?>
</div>  
                    <div class="span2" id="details"><span class="label label-info"> Default : Label Size:100px X 50px</span></div>
                </div>
            </div>
        </tr>
        <tr>
            <div class="row">
                <div class="col-md-3 col-sm-6">
                    <div class="span2"><?php 
echo $form->labelEx($model, 'depts', array('class' => 'inline-labels'));
?>
</div>
                    <div class="span3"><?php 
echo $form->dropDownList($model, 'depts', CHtml::listData(Dept::model()->findAllByAttributes(array('orgid' => Yii::app()->user->getState("org_id"))), 'id', 'name'), array('prompt' => '--- Select Department ---', 'ajax' => array('type' => 'POST', 'id' => 'drop_selection', 'url' => CController::createUrl('dynamicrows'), 'update' => '#Label_fileNames', 'data' => array('selection' => 'js:this.value'))));
 /**
  * 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 FileType the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = FileType::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
예제 #8
0
파일: _form.php 프로젝트: jessesiu/GigaDBV3
	        	<?php 
echo CHtml::activeDropDownList($model, 'format_id', CHtml::listData(FileFormat::model()->findAll(), 'id', 'name'));
?>
				<?php 
echo $form->error($model, 'format_id');
?>
			</div>
		</div>

		<div class="control-group">
			<?php 
echo $form->labelEx($model, 'type_id', array('class' => 'control-label'));
?>
			<div class="controls">
	        	<?php 
echo CHtml::activeDropDownList($model, 'type_id', CHtml::listData(FileType::model()->findAll(), 'id', 'name'));
?>
				<?php 
echo $form->error($model, 'type_id');
?>
			</div>
		</div>

		<div class="control-group">
			<?php 
echo $form->labelEx($model, 'sample_name', array('class' => 'control-label'));
?>
			<div class="controls">
	        			<?php 
echo CHtml::activeDropDownList($model, 'sample_name', CHtml::listData(Sample::model()->findAll(), 'id', 'name'), array('empty' => 'None'));
?>
예제 #9
0
 private function getFileType($type)
 {
     $file_type = FileType::model()->find("name=?", array($type));
     if ($file_type == null) {
         $file_type = new FileType();
         $file_type->name = $type;
         $file_type->description = " ";
         $file_type->save(false);
     }
     return $file_type->id;
 }
예제 #10
0
파일: File.php 프로젝트: jessesiu/GigaDBV3
 public static function getTypeList($ids)
 {
     $crit = new CDbCriteria();
     $crit->join = "join file on file.type_id = t.id";
     $crit->addInCondition("file.id", $ids);
     return FileType::model()->findAll($crit);
 }